agent-config 0.2.0

Install hooks/integrations into AI coding harnesses (Claude Code, Cursor, Gemini CLI, OpenCode, Codex CLI, Cline, Windsurf, ...) without learning each one's filesystem layout.
Documentation
# CodeBuddy CLI

ID: `codebuddy` — `agent_config::by_id("codebuddy")`

Tencent CodeBuddy mirrors the Claude Code config envelope.

## Surfaces

| Surface | Scope          | Notes                                  |
| ------- | -------------- | -------------------------------------- |
| Hooks   | Global + Local | Claude-shape JSON envelope (9 events)  |
| Prompt  | Global + Local | Fenced block in `CLAUDE.md`            |
| MCP     | -              | Not part of CodeBuddy's documented surface |
| Skills  | Global + Local | `SKILL.md` directories                 |

## Hooks

### User scope (`Scope::Global`)

| | |
| --- | --- |
| File | `~/.codebuddy/settings.json` |
| Mechanism | JSON patch |
| Backup | `~/.codebuddy/settings.json.bak` (first patch only) |

### Project scope (`Scope::Local(<root>)`)

| | |
| --- | --- |
| File | `<root>/.codebuddy/settings.json` |
| Mechanism | JSON patch |
| Backup | `<root>/.codebuddy/settings.json.bak` (first patch only) |

CodeBuddy also reads `<root>/.codebuddy/settings.local.json` (gitignored)
ahead of the project file. This crate writes the project-shared file.

### Format

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{ "type": "command", "command": "myapp hook codebuddy" }],
        "_agent_config_tag": "myapp"
      }
    ]
  }
}
```

### Event mapping

| `Event::*`     | CodeBuddy string |
| -------------- | ---------------- |
| `PreToolUse`   | `PreToolUse`     |
| `PostToolUse`  | `PostToolUse`    |
| `Custom(s)`    | `s`              |

CodeBuddy supports `Notification`, `UserPromptSubmit`, `Stop`, `SubagentStop`,
`PreCompact`, `SessionStart`, `SessionEnd` via `Event::Custom`.

### Matcher mapping

| `Matcher::*`        | CodeBuddy string |
| ------------------- | ---------------- |
| `All`               | `*`              |
| `Bash`              | `Bash`           |
| `Exact(s)`          | `s`              |
| `AnyOf([a, b])`     | `a\|b`           |
| `Regex(s)`          | `s` (verbatim)   |

## Prompt instructions

| | |
| --- | --- |
| User scope file | `~/.codebuddy/CLAUDE.md` |
| Project scope file | `<root>/CLAUDE.md` |
| Format | Tagged HTML-comment fence |

## Instructions

Standalone instruction files installed via `InstructionSurface`. Uses
`InstructionPlacement::InlineBlock` because CodeBuddy CLI's memory file does
not expose a documented `@import` syntax; the body is injected as a tagged
HTML-comment fenced block in the existing memory file.

### User scope (`Scope::Global`)

| | |
| --- | --- |
| Host file | `~/.codebuddy/CLAUDE.md` |
| Mechanism | Tagged HTML-comment fence (`<!-- BEGIN AGENT-CONFIG-INSTR:<name> -->`) |
| Ledger | `~/.codebuddy/.agent-config-instructions.json` |
| Placement | `InstructionPlacement::InlineBlock` |

### Project scope (`Scope::Local(<root>)`)

| | |
| --- | --- |
| Host file | `<root>/CLAUDE.md` |
| Mechanism | Tagged HTML-comment fence (`<!-- BEGIN AGENT-CONFIG-INSTR:<name> -->`) |
| Ledger | `<root>/.codebuddy/.agent-config-instructions.json` |
| Placement | `InstructionPlacement::InlineBlock` |

## Skills

| Scope | Path |
| --- | --- |
| User | `~/.codebuddy/skills/<name>/` |
| Project | `<root>/.codebuddy/skills/<name>/` |

## References

- <https://www.codebuddy.ai/docs/cli/>
- <https://www.codebuddy.ai/docs/cli/settings>
- <https://www.codebuddy.ai/docs/cli/hooks>

Accessed: 2026-04-26.