Skip to content

Commit ebe0ec9

Browse files
committed
updates readme and agent.md
1 parent a0dd4c2 commit ebe0ec9

2 files changed

Lines changed: 49 additions & 10 deletions

File tree

AGENTS.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ lua/askCode/ ← all plugin logic lives here
1515
├── init.lua ← agent registry (maps name → module)
1616
├── gemini.lua ← Gemini CLI integration
1717
├── kiro.lua ← Kiro CLI integration
18-
└── opencode.lua ← OpenCode CLI integration
18+
├── opencode.lua ← OpenCode CLI integration
19+
└── claude.lua ← Claude CLI integration
1920
plugin/askCode.lua ← Neovim commands + <Plug> keymaps (entry point)
2021
tests/ ← MiniTest suite (one file per module)
2122
scripts/minimal_init.lua ← headless Neovim init used by make test
2223
CODE-STANDARDS.md ← authoritative coding standards and architecture
24+
.agents/add-new-agent.md ← step-by-step plan for adding a new agent
25+
.claude/skills/add-agent/ ← Claude Code skill that automates adding a new agent
2326
```
2427

2528
## Key Entry Points
2629

2730
- **Feature work**: start in `lua/askCode/init.lua` — it orchestrates all modules
28-
- **Adding an agent**: create `lua/askCode/agents/<name>.lua`, register in `agents/init.lua`
31+
- **Adding an agent**: follow `.agents/add-new-agent.md`, or invoke the `/add-agent` Claude Code skill — create `lua/askCode/agents/<name>.lua`, register in `agents/init.lua`
2932
- **Config changes**: `lua/askCode/config.lua` — update `M.default` and annotations
3033
- **UI changes**: `lua/askCode/ui.lua``show_window` and `update_window`
3134
- **Commands/keymaps**: `plugin/askCode.lua`
@@ -55,6 +58,7 @@ Then users set `agent = "myagent"` in their config.
5558
- **Conversation history is a temp file**, not in-memory — `vim.fn.tempname()` path stored in `state.history_file`; full history is re-read and re-sent on every follow-up.
5659
- **Config merging uses `"keep"` strategy**`vim.tbl_deep_extend("keep", changes, current)` means user values win over defaults, not the other way around.
5760
- **`opencode` agent uses a temp file for the prompt** — multiline prompts can't be safely passed via `shellescape` through `sh -c`; the agent writes the prompt to a temp file and uses `"$(cat <tmpfile>)"` in the command. It also requires `--format json` so the process exits cleanly.
61+
- **`claude` agent uses a temp file for the prompt** — same rationale as opencode; the prompt is written to a temp file and passed to `claude -p "$(cat <tmpfile>)"`. The `-p` flag makes Claude CLI non-interactive and outputs plain text, so `parse_response` only trims whitespace with no JSON parsing.
5862

5963
## Repo-Specific Tools
6064

@@ -82,6 +86,24 @@ Tests use `MiniTest.new_child_neovim()` — each test case restarts a fresh chil
8286
- `vim.g.askcode_range` is set in `plugin/askCode.lua` for `AskCodeReplace` but never read — dead code.
8387
- `debug` logging only covers `init.lua`; agents and ui emit no debug output.
8488

89+
## Adding a New Agent
90+
91+
Use the `/add-agent` Claude Code skill to add a new agent in one step:
92+
93+
```
94+
/add-agent <agent_name> <cli_invocation>
95+
```
96+
97+
Example:
98+
99+
```
100+
/add-agent claude "claude -p"
101+
```
102+
103+
The skill reads the full implementation plan from `.agents/add-new-agent.md` and executes all steps automatically: creates the agent module, registers it, updates docs, writes unit tests, and verifies with `make test`.
104+
105+
To add an agent manually without the skill, follow `.agents/add-new-agent.md` step by step.
106+
85107
## Detailed Documentation
86108

87109
Full documentation is in `.agents/summary/`:

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AskCode.nvim
22

3-
AskCode is a Neovim plugin that helps developers explore and understand codebases by connecting to CLI-based AI assistants like `gemini-cli`, `kiro-cli`, and `opencode`. It acts as your in-editor guide, letting you ask context-aware questions about selected code and receive answers without leaving Neovim.
3+
AskCode is a Neovim plugin that helps developers explore and understand codebases by connecting to CLI-based AI assistants like `gemini-cli`, `kiro-cli`, `opencode`, and `claude`. It acts as your in-editor guide, letting you ask context-aware questions about selected code and receive answers without leaving Neovim.
44

55
![Image](https://github.com/user-attachments/assets/e5f0dadb-9bdc-4b43-8c77-15a11810a3da)
66

@@ -18,15 +18,16 @@ AskCode is a Neovim plugin that helps developers explore and understand codebase
1818
### Prerequisites
1919

2020
- Neovim (v0.9.0 or later)
21-
- A compatible AI assistant CLI installed and configured in your shell environment (e.g., `gemini-cli`, `kiro-cli`, `opencode`).
21+
- A compatible AI assistant CLI installed and configured in your shell environment (e.g., `gemini-cli`, `kiro-cli`, `opencode`, `claude`).
2222

2323
### Supported Agents
2424

25-
| Agent key | CLI | Notes |
26-
| ---------- | ----------------------------------------------------------- | ------------------------- |
27-
| `gemini` | [`gemini-cli`](https://github.com/google-gemini/gemini-cli) | Default agent |
28-
| `kiro` | [`kiro-cli`](https://kiro.dev) | Reads from stderr |
29-
| `opencode` | [`opencode`](https://opencode.ai) | Uses `--format json` mode |
25+
| Agent key | CLI | Notes |
26+
| ---------- | ----------------------------------------------------------- | ---------------------------------- |
27+
| `gemini` | [`gemini-cli`](https://github.com/google-gemini/gemini-cli) | Default agent |
28+
| `kiro` | [`kiro-cli`](https://kiro.dev) | Reads from stderr |
29+
| `opencode` | [`opencode`](https://opencode.ai) | Uses `--format json` mode |
30+
| `claude` | [`claude`](https://github.com/anthropics/claude-code) | Uses `claude -p` non-interactive mode |
3031

3132
### Installation
3233

@@ -145,6 +146,22 @@ vim.keymap.set("v", "<leader>ae", ":AskCode <Plug>(AskCodeAddDocstring)")
145146
vim.keymap.set("v", "<leader>ar", ":AskCodeReplace \"Refactor this code\"<CR>", { noremap = true, silent = true })
146147
```
147148

149+
## Adding a New Agent
150+
151+
Use the `/add-agent` Claude Code skill to integrate any CLI-based AI assistant:
152+
153+
```
154+
/add-agent <agent_name> <cli_invocation>
155+
```
156+
157+
For example:
158+
159+
```
160+
/add-agent myagent "myagent ask"
161+
```
162+
163+
This skill creates the agent module, registers it, updates docs, and writes a full unit test suite — all verified by `make test`. See `.agents/add-new-agent.md` for the step-by-step plan if you prefer to do it manually.
164+
148165
## Development
149166

150167
Contributions are welcome! To get started with development:
@@ -179,7 +196,7 @@ The project uses `mini.nvim` for its testing framework. You can find more inform
179196
## Todo
180197

181198
- [ ] **Support Prompt Templates**: Allow users to define custom prompt templates in the configuration.
182-
- [ ] **Integrate Claude-Code Agent**: Add a new agent for ClaudeCode by implementing the `prepare_command` function for its CLI.
199+
- [x] **Integrate Claude Agent**: Add a new agent for Claude CLI using `claude -p` non-interactive mode.
183200
- [ ] **Support Streaming JSON**: Improve the stream processor to parse chunked JSON responses for real-time display.
184201
- [x] **Support Follow-up Questions**: Maintain conversation history to allow for follow-up questions.
185202
- [x] **Integrate Kiro Agent**: Add a new agent for Kiro by implementing the `prepare_command` function for its CLI.

0 commit comments

Comments
 (0)