cairn-ai 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/workflows/cairn-doctor.md +22 -0
- package/.agents/workflows/cairn-install.md +17 -0
- package/.agents/workflows/cairn-memory.md +15 -0
- package/.agents/workflows/cairn-plan.md +21 -0
- package/.agents/workflows/cairn-review.md +14 -0
- package/.agents/workflows/cairn-toolcheck.md +17 -0
- package/.agents/workflows/cairn-uninstall.md +17 -0
- package/.agents/workflows/cairn-upgrade.md +17 -0
- package/.agents/workflows/cairn-work.md +20 -0
- package/.claude/agents/explorer.md +5 -0
- package/.claude/agents/worker.md +5 -0
- package/.claude/commands/cairn-doctor.md +13 -0
- package/.claude/commands/cairn-install.md +13 -0
- package/.claude/commands/cairn-memory.md +5 -0
- package/.claude/commands/cairn-plan.md +5 -0
- package/.claude/commands/cairn-review.md +5 -0
- package/.claude/commands/cairn-toolcheck.md +10 -0
- package/.claude/commands/cairn-uninstall.md +13 -0
- package/.claude/commands/cairn-upgrade.md +13 -0
- package/.claude/commands/cairn-work.md +5 -0
- package/.codex-plugin/plugin.json +30 -0
- package/LICENSE +21 -0
- package/README.de.md +130 -0
- package/README.es.md +130 -0
- package/README.fr.md +130 -0
- package/README.ja.md +130 -0
- package/README.ko.md +130 -0
- package/README.md +138 -0
- package/README.pt.md +130 -0
- package/README.zh.md +130 -0
- package/agents/explorer.md +31 -0
- package/agents/worker.md +32 -0
- package/commands/cairn-doctor.md +27 -0
- package/commands/cairn-install.md +24 -0
- package/commands/cairn-memory.md +17 -0
- package/commands/cairn-plan.md +23 -0
- package/commands/cairn-review.md +16 -0
- package/commands/cairn-toolcheck.md +19 -0
- package/commands/cairn-uninstall.md +24 -0
- package/commands/cairn-upgrade.md +23 -0
- package/commands/cairn-work.md +22 -0
- package/docs/model-guidance/README.md +31 -0
- package/docs/model-guidance/claude.md +46 -0
- package/docs/model-guidance/codex.md +48 -0
- package/hooks/hooks.json +65 -0
- package/package.json +49 -0
- package/scripts/cairn +115 -0
- package/scripts/cairn-lifecycle.mjs +343 -0
- package/scripts/cairn-state.sh +104 -0
- package/scripts/cairn-toolcheck.mjs +205 -0
- package/skills/cairn-memory/SKILL.md +40 -0
- package/skills/cairn-plan/SKILL.md +137 -0
- package/skills/cairn-review/SKILL.md +44 -0
- package/skills/cairn-work/SKILL.md +81 -0
- package/templates/MEMORY.md +14 -0
- package/templates/PLAN.md +17 -0
- package/templates/domain-memory.md +20 -0
- package/templates/work-plan.md +86 -0
package/README.pt.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Cairn
|
|
2
|
+
|
|
3
|
+
Cairn e um plugin de harness multiagente eficiente em tokens para Codex, Claude Code e Antigravity.
|
|
4
|
+
|
|
5
|
+
[English](README.md)
|
|
6
|
+
|
|
7
|
+
A ideia central e manter comportamentos uteis de agent harness: hooks, estado persistente, planejamento explicito, delegacao focada e guardas no momento de parada. Cairn nao torna loops repetidos de verificacao TDD o padrao. Em vez disso, divide o trabalho em pequenos module slices e prova cada slice com dois verification gates.
|
|
8
|
+
|
|
9
|
+
1. Module acceptance verification: prova o contrato do modulo alterado.
|
|
10
|
+
2. Surface integration verification: prova o comportamento por uma superficie real, como CLI, HTTP, navegador ou artefatos de arquivo.
|
|
11
|
+
|
|
12
|
+
Antes que um slice altere estado externo, Cairn registra e executa o dry-run ou check mode mais proximo disponivel. A verificacao e limitada: cada slice recebe duas verification passes por padrao; depois, o agente registra um blocker ou divide o slice em vez de continuar um loop aberto.
|
|
13
|
+
|
|
14
|
+
Cairn tambem trata tool readiness como parte do trabalho. LSP, typecheck, lint, dry-run e verification tools sao verificados contra o stack do repositorio. Se uma ferramenta obrigatoria estiver ausente, Cairn tenta uma instalacao project-local ou repository-native antes de aceitar um fallback.
|
|
15
|
+
|
|
16
|
+
## LazyCodex Attribution
|
|
17
|
+
|
|
18
|
+
Cairn e influenciado pelo LazyCodex (`https://github.com/code-yeongyu/lazycodex`). As ideias aproveitadas sao o formato de agent harness instalavel, Codex hook trust/setup handling, project memory, planning skills, executable workflow commands, diagnostics e skill/agent packaging entre local agent surfaces.
|
|
19
|
+
|
|
20
|
+
Cairn diverge intencionalmente do LazyCodex na execution policy. Ele nao adota o role-chain execution model nem open-ended completion loops do LazyCodex. Cairn usa Light/Heavy Path triage, delegacao limitada `explorer`/`worker`, dois verification gates e explicit stop conditions.
|
|
21
|
+
|
|
22
|
+
## Complexity Triage
|
|
23
|
+
|
|
24
|
+
Cada implementation task passa primeiro por complexity triage, antes de aplicar agent, plugin ou delegated workflow guidance. O triage e decidido a partir da exploracao do repositorio, do escopo esperado da mudanca e de sinais de risco, sem perguntar ao usuario por fatos descobriveis.
|
|
25
|
+
|
|
26
|
+
- Light Path: mudancas estreitas dentro de existing architecture layers. E o padrao. Implemente diretamente ou use um `worker` limitado, depois mantenha o verification gate.
|
|
27
|
+
- Heavy Path: new directory/module/layer, new domain model/service/abstraction, security/session/auth, external API/message queue/payment, DB schema/migration, concurrency/transaction/cache changes, cross-domain refactor ou explicit extra-care request.
|
|
28
|
+
|
|
29
|
+
O path escolhido e sua justificativa sao registrados em `docs/plan/<topic>.md` quando houver um plan artifact. Mesmo no Light Path, os dois verification gates permanecem.
|
|
30
|
+
|
|
31
|
+
## Tool Readiness
|
|
32
|
+
|
|
33
|
+
`cairn toolcheck` inspeciona o repositorio atual para stacks JavaScript, TypeScript, Python, PHP, Java, Kotlin, Swift, Go e Rust, depois verifica os LSP e verification tools correspondentes.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
cairn toolcheck
|
|
37
|
+
cairn toolcheck --install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- `toolcheck` informa detected stacks e missing tools.
|
|
41
|
+
- `toolcheck --install` tenta o caminho de instalacao project-local ou repository-native mais proximo, como dev dependencies do package manager, dev dependencies do Composer, `uv`, Java LSP bootstrap, `go install` ou `rustup component add`.
|
|
42
|
+
- Os planos Cairn registram detected stack, required tools, install commands e blockers.
|
|
43
|
+
- Um LSP server ausente nao e motivo valido para pular precise codebase exploration antes de tentar installation ou um fallback symbol-aware equivalente.
|
|
44
|
+
|
|
45
|
+
## Dry-Run And Loop Policy
|
|
46
|
+
|
|
47
|
+
- Migrations e database changes usam `--pretend`, dry-run, schema diff, rollback feasibility checks ou o equivalente repository-native mais proximo antes de write/apply commands.
|
|
48
|
+
- Package, release, infrastructure, deployment, code generation e formatting work usam check, plan, diff, validate ou dry-run modes antes de alterar estado quando disponiveis.
|
|
49
|
+
- Se nao houver dry-run, o plan registra esse fato e escolhe o menor command reversivel ou test artifact disponivel.
|
|
50
|
+
- Se um verification gate falhar, Cairn diagnostica uma vez, reduz ou divide o slice e executa novamente os dois gates.
|
|
51
|
+
- Depois de duas verification passes falhas para o mesmo slice, Cairn registra o blocker em `docs/plan/<topic>.md` em vez de continuar um loop repetido.
|
|
52
|
+
|
|
53
|
+
## Model Guidance
|
|
54
|
+
|
|
55
|
+
Cairn aplica model-specific adjustment apenas a modelos Claude-family e Codex-family.
|
|
56
|
+
|
|
57
|
+
- Claude-family: util para long context, policy interpretation e plan/evidence review.
|
|
58
|
+
- Codex-family: util para small implementation slices, explicit file edits, command-based verification e bounded `worker` tasks.
|
|
59
|
+
|
|
60
|
+
A orientacao detalhada fica em `docs/model-guidance/README.md`, `docs/model-guidance/claude.md` e `docs/model-guidance/codex.md`.
|
|
61
|
+
|
|
62
|
+
## Repository Artifacts
|
|
63
|
+
|
|
64
|
+
O harness cria e mantem estes arquivos na raiz do repositorio alvo.
|
|
65
|
+
|
|
66
|
+
- `MEMORY.md`: indice curto de persistent domain knowledge.
|
|
67
|
+
- `docs/memory/*.md`: conhecimento detalhado por dominio.
|
|
68
|
+
- `docs/model-guidance/*.md`: Claude and Codex model adjustment guidance.
|
|
69
|
+
- `PLAN.md`: indice curto de active and completed work topics.
|
|
70
|
+
- `docs/plan/*.md`: detailed execution plans.
|
|
71
|
+
|
|
72
|
+
Arquivos raiz ficam curtos e os detalhes vao para `docs/`, para que agentes leiam apenas o contexto necessario.
|
|
73
|
+
|
|
74
|
+
## Commands
|
|
75
|
+
|
|
76
|
+
O pacote publicado pode ser executado com `bunx` ou comandos `cairn` instalados globalmente.
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
bunx cairn-ai@latest install
|
|
80
|
+
bunx cairn-ai@latest upgrade
|
|
81
|
+
bunx cairn-ai@latest doctor
|
|
82
|
+
bunx cairn-ai@latest uninstall
|
|
83
|
+
bunx cairn-ai@latest toolcheck
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Apos a instalacao global, comandos curtos tambem ficam disponiveis.
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
bun add -g cairn-ai
|
|
90
|
+
cairn install
|
|
91
|
+
cairn upgrade
|
|
92
|
+
cairn doctor
|
|
93
|
+
cairn uninstall
|
|
94
|
+
cairn toolcheck
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- `cairn install`: instala o plugin no Codex marketplace cache e configura hook trust state, Claude Code mirror files e Antigravity skills/workflows.
|
|
98
|
+
- `cairn upgrade`: atualiza installation, hook trust state, Claude Code mirror files e Antigravity skills/workflows a partir da source atual.
|
|
99
|
+
- `cairn doctor`: diagnostica Codex settings, installation, hook trust state, Claude Code mirror files e Antigravity mirror files.
|
|
100
|
+
- `cairn uninstall`: remove Codex settings, cache, Claude Code mirror files e Antigravity mirror files adicionados pelo Cairn.
|
|
101
|
+
- `cairn toolcheck`: detecta repository stacks e verifica ou instala required LSP e verification tools.
|
|
102
|
+
- `cairn-memory`: explora domain knowledge e atualiza `MEMORY.md`.
|
|
103
|
+
- `cairn-plan`: cria um decision-complete plan em `docs/plan/`.
|
|
104
|
+
- `cairn-work`: executa o proximo module slice no `PLAN.md` atual com dois verification gates.
|
|
105
|
+
- `cairn-review`: revisa completed slices contra plan, memory e evidence.
|
|
106
|
+
|
|
107
|
+
`install` e `upgrade` criam backups `*.cairn-backup-*` antes de modificar `~/.codex/config.toml`. O source plugin manifest permanece validator-friendly; apenas a installed cache copy recebe um campo `hooks` para ativar Codex hooks.
|
|
108
|
+
|
|
109
|
+
Codex usa `skills/` e `commands/`. Claude Code usa comandos espelhados e agent definitions em `.claude/`. Antigravity usa `.agents/workflows` e global skills mirrors.
|
|
110
|
+
|
|
111
|
+
## Antigravity Compatibility
|
|
112
|
+
|
|
113
|
+
Antigravity suporta Agent Skills e Workflows baseados em `SKILL.md` chamados como `/workflow-name`. Cairn instala estes paths para essa superficie.
|
|
114
|
+
|
|
115
|
+
- Antigravity IDE: `~/.agents/skills/cairn-*`, `~/.agents/workflows/cairn-*.md`.
|
|
116
|
+
- Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn-*`, `~/.gemini/antigravity-cli/workflows/cairn-*.md`.
|
|
117
|
+
|
|
118
|
+
Codex-only hooks nao sao portados para Antigravity. Em vez disso, os mesmos procedimentos de planning, memory, complexity triage e two-gate verification rodam por Skills e Workflows. Defina `ANTIGRAVITY_HOME` ou `ANTIGRAVITY_CLI_HOME` para sobrescrever paths.
|
|
119
|
+
|
|
120
|
+
## Locale Policy
|
|
121
|
+
|
|
122
|
+
As instrucoes reutilizaveis do Cairn sao escritas em English para global use. User-visible output deve seguir o OS locale configurado, a menos que o usuario peca explicitamente outro idioma. A CLI localiza mensagens comuns para `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de` e `pt`, e volta para English em unsupported locales. O texto `statusMessage` dos Codex hooks permanece static English, enquanto hook command output e English ou Korean.
|
|
123
|
+
|
|
124
|
+
## Delegation
|
|
125
|
+
|
|
126
|
+
- `explorer`: lida com read-only codebase discovery, impact analysis, pattern searches e read-only verification quando disponivel.
|
|
127
|
+
- `worker`: lida com bounded implementation ou verification tasks com file ownership claro.
|
|
128
|
+
- Main session: mantem urgent blocking work local quando o proximo passo depende imediatamente do resultado.
|
|
129
|
+
|
|
130
|
+
Todo delegation prompt usa seis sections: TASK, EXPECTED OUTCOME, REQUIRED TOOLS, MUST DO, MUST NOT DO, CONTEXT.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Cairn
|
|
2
|
+
|
|
3
|
+
Cairn 是面向 Codex、Claude Code 和 Antigravity 的高 token 效率 multi-agent harness plugin。
|
|
4
|
+
|
|
5
|
+
[English](README.md)
|
|
6
|
+
|
|
7
|
+
Cairn 的核心思路是保留有用的 agent harness 行为:hooks、persistent state、explicit planning、focused delegation 和 stop-time guards。Cairn 不把重复的 TDD verification loops 作为默认流程,而是把工作拆成小的 module slices,并用两个 verification gates 证明每个 slice。
|
|
8
|
+
|
|
9
|
+
1. Module acceptance verification: 证明被修改的 module contract。
|
|
10
|
+
2. Surface integration verification: 通过 CLI、HTTP、browser 或 file artifacts 等真实 surface 证明行为。
|
|
11
|
+
|
|
12
|
+
在 slice 修改外部状态之前,Cairn 会记录并运行最接近的 dry-run 或 check mode。verification 是有边界的:默认每个 slice 有两次 verification pass,然后 agent 会记录 blocker 或拆分 slice,而不是继续开放式循环。
|
|
13
|
+
|
|
14
|
+
Cairn 也把 tool readiness 视为工作的一部分。它会根据 repository stack 检查 LSP、typecheck、lint、dry-run 和 verification tools。如果缺少必要工具,Cairn 会先尝试 project-local 或 repository-native installation,再接受 fallback。
|
|
15
|
+
|
|
16
|
+
## LazyCodex Attribution
|
|
17
|
+
|
|
18
|
+
Cairn 受到 LazyCodex(`https://github.com/code-yeongyu/lazycodex`)影响。受影响的部分包括 installable agent-harness shape、Codex hook trust/setup handling、project memory、planning skills、executable workflow commands、diagnostics,以及跨 local agent surfaces 的 skill/agent packaging。
|
|
19
|
+
|
|
20
|
+
Cairn 在 execution policy 上刻意不同于 LazyCodex。它不采用 LazyCodex 的 role-chain execution model 或 open-ended completion loop。Cairn 使用 Light/Heavy Path triage、bounded `explorer`/`worker` delegation、两个 verification gates 和 explicit stop conditions。
|
|
21
|
+
|
|
22
|
+
## Complexity Triage
|
|
23
|
+
|
|
24
|
+
每个 implementation task 都先经过 complexity triage,然后才应用 agent、plugin 或 delegated workflow guidance。triage 根据 repository exploration、expected change scope 和 risk signals 判断,不向用户询问可发现的信息。
|
|
25
|
+
|
|
26
|
+
- Light Path: existing architecture layers 内的窄范围修改。这是默认路径。可以直接实现,或使用一个 bounded `worker`,然后保留 verification gate。
|
|
27
|
+
- Heavy Path: new directory/module/layer、new domain model/service/abstraction、security/session/auth、external API/message queue/payment、DB schema/migration、concurrency/transaction/cache changes、cross-domain refactor,或明确的 extra-care request。
|
|
28
|
+
|
|
29
|
+
选中的 path 和理由会在存在 plan artifact 时记录在 `docs/plan/<topic>.md`。即使是 Light Path,也保留两个 verification gates。
|
|
30
|
+
|
|
31
|
+
## Tool Readiness
|
|
32
|
+
|
|
33
|
+
`cairn toolcheck` 会检查当前 repository 中的 JavaScript、TypeScript、Python、PHP、Java、Kotlin、Swift、Go 和 Rust stacks,然后检查匹配的 LSP 和 verification tools。
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
cairn toolcheck
|
|
37
|
+
cairn toolcheck --install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- `toolcheck` 报告 detected stacks 和 missing tools。
|
|
41
|
+
- `toolcheck --install` 尝试最接近的 project-local 或 repository-native install path,例如 package-manager dev dependencies、Composer dev dependencies、`uv`、Java LSP bootstrap、`go install` 或 `rustup component add`。
|
|
42
|
+
- Cairn plans 会记录 detected stack、required tools、install commands 和 blockers。
|
|
43
|
+
- 缺少 LSP server 不能作为跳过 precise codebase exploration 的理由,除非已尝试 installation 或等价的 symbol-aware fallback。
|
|
44
|
+
|
|
45
|
+
## Dry-Run And Loop Policy
|
|
46
|
+
|
|
47
|
+
- Migrations 和 database changes 在 write/apply commands 前使用 `--pretend`、dry-run、schema diff、rollback feasibility checks 或最接近的 repository-native equivalent。
|
|
48
|
+
- Package、release、infrastructure、deployment、code generation 和 formatting work 在可用时,先使用 check、plan、diff、validate 或 dry-run modes,再修改状态。
|
|
49
|
+
- 如果没有 dry-run,plan 会记录该事实,并选择最小且可逆的 command 或 test artifact。
|
|
50
|
+
- 如果 verification gate 失败,Cairn 会诊断一次,缩小或拆分 slice,然后重新运行两个 gates。
|
|
51
|
+
- 同一 slice 两次 verification pass 失败后,Cairn 会在 `docs/plan/<topic>.md` 中记录 blocker,而不是继续重复循环。
|
|
52
|
+
|
|
53
|
+
## Model Guidance
|
|
54
|
+
|
|
55
|
+
Cairn 只对 Claude-family 和 Codex-family models 应用 model-specific adjustment。
|
|
56
|
+
|
|
57
|
+
- Claude-family: 适合 long context、policy interpretation 和 plan/evidence review。
|
|
58
|
+
- Codex-family: 适合 small implementation slices、explicit file edits、command-based verification 和 bounded `worker` tasks。
|
|
59
|
+
|
|
60
|
+
详细指南位于 `docs/model-guidance/README.md`、`docs/model-guidance/claude.md` 和 `docs/model-guidance/codex.md`。
|
|
61
|
+
|
|
62
|
+
## Repository Artifacts
|
|
63
|
+
|
|
64
|
+
harness 会在目标 repository root 创建并维护这些文件。
|
|
65
|
+
|
|
66
|
+
- `MEMORY.md`: persistent domain knowledge 的短索引。
|
|
67
|
+
- `docs/memory/*.md`: 按 domain 记录的详细 knowledge。
|
|
68
|
+
- `docs/model-guidance/*.md`: Claude 和 Codex model adjustment guidance。
|
|
69
|
+
- `PLAN.md`: active 和 completed work topics 的短索引。
|
|
70
|
+
- `docs/plan/*.md`: detailed execution plans。
|
|
71
|
+
|
|
72
|
+
root files 保持简短,细节移到 `docs/` 下,让 agents 只读取当前任务需要的 context。
|
|
73
|
+
|
|
74
|
+
## Commands
|
|
75
|
+
|
|
76
|
+
发布后的 package 可以通过 `bunx` 或全局安装的 `cairn` commands 执行。
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
bunx cairn-ai@latest install
|
|
80
|
+
bunx cairn-ai@latest upgrade
|
|
81
|
+
bunx cairn-ai@latest doctor
|
|
82
|
+
bunx cairn-ai@latest uninstall
|
|
83
|
+
bunx cairn-ai@latest toolcheck
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
全局安装后也可以使用短命令。
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
bun add -g cairn-ai
|
|
90
|
+
cairn install
|
|
91
|
+
cairn upgrade
|
|
92
|
+
cairn doctor
|
|
93
|
+
cairn uninstall
|
|
94
|
+
cairn toolcheck
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- `cairn install`: 将 plugin 安装到 Codex marketplace cache,并配置 hook trust state、Claude Code mirror files 和 Antigravity skills/workflows。
|
|
98
|
+
- `cairn upgrade`: 从当前 source 更新 installation、hook trust state、Claude Code mirror files 和 Antigravity skills/workflows。
|
|
99
|
+
- `cairn doctor`: 诊断 Codex settings、installation、hook trust state、Claude Code mirror files 和 Antigravity mirror files。
|
|
100
|
+
- `cairn uninstall`: 移除 Cairn 添加的 Codex settings、cache、Claude Code mirror files 和 Antigravity mirror files。
|
|
101
|
+
- `cairn toolcheck`: 检测 repository stacks,并检查或安装 required LSP 和 verification tools。
|
|
102
|
+
- `cairn-memory`: 探索 domain knowledge 并更新 `MEMORY.md`。
|
|
103
|
+
- `cairn-plan`: 在 `docs/plan/` 下创建 decision-complete plan。
|
|
104
|
+
- `cairn-work`: 执行当前 `PLAN.md` 中的下一个 module slice,并收集两个 verification gates。
|
|
105
|
+
- `cairn-review`: 根据 plan、memory 和 evidence review completed slices。
|
|
106
|
+
|
|
107
|
+
`install` 和 `upgrade` 在修改 `~/.codex/config.toml` 前会创建 `*.cairn-backup-*` backups。source plugin manifest 保持 validator-friendly;只有 installed cache copy 会添加启用 Codex hooks 的 `hooks` field。
|
|
108
|
+
|
|
109
|
+
Codex 使用 `skills/` 和 `commands/`。Claude Code 使用 `.claude/` 下的 mirrored commands 和 agent definitions。Antigravity 使用 `.agents/workflows` 和 global skills mirrors。
|
|
110
|
+
|
|
111
|
+
## Antigravity Compatibility
|
|
112
|
+
|
|
113
|
+
Antigravity 支持通过 `/workflow-name` 调用的 `SKILL.md` based Agent Skills and Workflows。Cairn 会为该 surface 安装这些 paths。
|
|
114
|
+
|
|
115
|
+
- Antigravity IDE: `~/.agents/skills/cairn-*`, `~/.agents/workflows/cairn-*.md`.
|
|
116
|
+
- Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn-*`, `~/.gemini/antigravity-cli/workflows/cairn-*.md`.
|
|
117
|
+
|
|
118
|
+
Codex-only hooks 不会移植到 Antigravity。相同的 planning、memory、complexity triage 和 two-gate verification procedures 会通过 Skills 和 Workflows 运行。设置 `ANTIGRAVITY_HOME` 或 `ANTIGRAVITY_CLI_HOME` 可以覆盖 paths。
|
|
119
|
+
|
|
120
|
+
## Locale Policy
|
|
121
|
+
|
|
122
|
+
Cairn 的 reusable instructions 为了 global use 使用英文编写。除非用户明确要求其他语言,user-visible output 应遵循 configured OS locale。CLI 会本地化 `en`、`ko`、`ja`、`zh`、`es`、`fr`、`de` 和 `pt` 的 common messages,不支持的 locales fallback 到 English。Codex hook `statusMessage` text 保持 static English,而 hook command output 为 English 或 Korean。
|
|
123
|
+
|
|
124
|
+
## Delegation
|
|
125
|
+
|
|
126
|
+
- `explorer`: 可用时处理 read-only codebase discovery、impact analysis、pattern search 和 read-only verification。
|
|
127
|
+
- `worker`: 处理具有明确 file ownership 的 bounded implementation 或 verification task。
|
|
128
|
+
- Main session: 当下一步立即依赖结果时,本地处理 urgent blocking work。
|
|
129
|
+
|
|
130
|
+
每个 delegation prompt 都使用六个 sections: TASK、EXPECTED OUTCOME、REQUIRED TOOLS、MUST DO、MUST NOT DO、CONTEXT。
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explorer
|
|
3
|
+
description: Read-only discovery agent for codebase questions, impact analysis, pattern search, and verification.
|
|
4
|
+
model: sonnet
|
|
5
|
+
tools: Read, Grep, Glob, Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# explorer
|
|
9
|
+
|
|
10
|
+
Handle read-only discovery and verification tasks.
|
|
11
|
+
|
|
12
|
+
Use for:
|
|
13
|
+
|
|
14
|
+
- Codebase questions.
|
|
15
|
+
- Impact analysis.
|
|
16
|
+
- Pattern searches.
|
|
17
|
+
- Exact file and symbol discovery.
|
|
18
|
+
- Read-only verification that can run independently.
|
|
19
|
+
|
|
20
|
+
Do not edit files. Do not ask the user before exhausting repository evidence. Preserve proper nouns exactly as written. Report only important paths, commands, and outputs accurately.
|
|
21
|
+
|
|
22
|
+
Use this prompt format:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
TASK:
|
|
26
|
+
EXPECTED OUTCOME:
|
|
27
|
+
REQUIRED TOOLS:
|
|
28
|
+
MUST DO:
|
|
29
|
+
MUST NOT DO:
|
|
30
|
+
CONTEXT:
|
|
31
|
+
```
|
package/agents/worker.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worker
|
|
3
|
+
description: Focused execution agent for repository search, small edits, command checks, and QA artifacts.
|
|
4
|
+
model: sonnet
|
|
5
|
+
tools: Read, Grep, Glob, Bash, Write, Edit, MultiEdit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# worker
|
|
9
|
+
|
|
10
|
+
Handle narrow, focused tasks.
|
|
11
|
+
|
|
12
|
+
Use for:
|
|
13
|
+
|
|
14
|
+
- Finding exact files and symbols.
|
|
15
|
+
- Checking and bootstrapping LSP, typecheck, lint, dry-run, and verification tools.
|
|
16
|
+
- Small mechanical edits.
|
|
17
|
+
- Checking command availability.
|
|
18
|
+
- Capturing evidence artifacts.
|
|
19
|
+
- Cleanup verification.
|
|
20
|
+
|
|
21
|
+
Do not make architecture decisions. Do not ask the user. Do not treat a missing tool as unavailable until install or bootstrap has been attempted. Report only important paths, commands, and outputs accurately.
|
|
22
|
+
|
|
23
|
+
Use this prompt format:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
TASK:
|
|
27
|
+
EXPECTED OUTCOME:
|
|
28
|
+
REQUIRED TOOLS:
|
|
29
|
+
MUST DO:
|
|
30
|
+
MUST NOT DO:
|
|
31
|
+
CONTEXT:
|
|
32
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# cairn-doctor
|
|
2
|
+
|
|
3
|
+
Goal: diagnose Cairn installation status.
|
|
4
|
+
|
|
5
|
+
Run:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
scripts/cairn doctor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With the published package:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bunx cairn-ai@latest doctor
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Checks:
|
|
18
|
+
|
|
19
|
+
- Source plugin manifest.
|
|
20
|
+
- Codex cached installation.
|
|
21
|
+
- Marketplace file.
|
|
22
|
+
- Hook manifest link in the installed copy.
|
|
23
|
+
- `features.plugins`, `features.plugin_hooks`.
|
|
24
|
+
- `cairn@cairn` plugin enabled.
|
|
25
|
+
- hook trust state.
|
|
26
|
+
- Claude Code commands and agents mirror files.
|
|
27
|
+
- Antigravity IDE/CLI skills and workflows mirror files.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# cairn-install
|
|
2
|
+
|
|
3
|
+
Goal: install Cairn into Codex, Claude Code, and Antigravity.
|
|
4
|
+
|
|
5
|
+
Run:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
scripts/cairn install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With the published package:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bunx cairn-ai@latest install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Actions:
|
|
18
|
+
|
|
19
|
+
- Copy the Cairn installation into the Codex marketplace cache.
|
|
20
|
+
- Add the `hooks/hooks.json` link to the installed manifest.
|
|
21
|
+
- Register marketplace, plugin, and hook trust state in `~/.codex/config.toml`.
|
|
22
|
+
- Install `cairn-*` commands and agents mirror files for Claude Code.
|
|
23
|
+
- Install `cairn-*` skills and workflows mirror files for Antigravity IDE/CLI.
|
|
24
|
+
- Create `*.cairn-backup-*` backups before changing settings.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# cairn-memory
|
|
2
|
+
|
|
3
|
+
Use the `cairn-memory` skill.
|
|
4
|
+
|
|
5
|
+
Prerequisite: if `scripts/cairn doctor` fails, restore installation with `scripts/cairn install` or `scripts/cairn upgrade`.
|
|
6
|
+
|
|
7
|
+
Goal: create or update repository memory without asking the user for discoverable facts.
|
|
8
|
+
|
|
9
|
+
Procedure:
|
|
10
|
+
|
|
11
|
+
1. Run the plugin state initialization script.
|
|
12
|
+
2. Read `MEMORY.md`.
|
|
13
|
+
3. Explore repository facts with focused tools.
|
|
14
|
+
4. Use `explorer` for read-only domain discovery and contradiction checks when available; use `worker` for exact references, command checks, and bounded evidence capture.
|
|
15
|
+
5. Write details to `docs/memory/<domain>.md`.
|
|
16
|
+
6. Keep `MEMORY.md` as a short index.
|
|
17
|
+
7. Use the OS locale for user-visible output unless the user asks for another language.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# cairn-plan
|
|
2
|
+
|
|
3
|
+
Use the `cairn-plan` skill.
|
|
4
|
+
|
|
5
|
+
Prerequisite: if `scripts/cairn doctor` fails, restore installation with `scripts/cairn install` or `scripts/cairn upgrade`.
|
|
6
|
+
|
|
7
|
+
Goal: leave a decision-complete plan for the current task in files.
|
|
8
|
+
|
|
9
|
+
Procedure:
|
|
10
|
+
|
|
11
|
+
1. Read `MEMORY.md` and relevant `docs/memory/*.md`.
|
|
12
|
+
2. If the active or assigned model is Claude-family, read `docs/model-guidance/claude.md`; if Codex-family, read `docs/model-guidance/codex.md`.
|
|
13
|
+
3. Run `scripts/cairn toolcheck` when available.
|
|
14
|
+
4. If required LSP/check tools are missing, run `scripts/cairn toolcheck --install` or a repository-native install command before accepting a fallback.
|
|
15
|
+
5. Explore before asking the user.
|
|
16
|
+
6. Run complexity triage before applying agent, plugin, or delegated workflow guidance.
|
|
17
|
+
7. Use Light Path by default unless a Heavy Path condition clearly applies.
|
|
18
|
+
8. Use `explorer` for independent read-only discovery, impact analysis, pattern search, and read-only verification when available.
|
|
19
|
+
9. Use `worker` for bounded implementation or verification tasks with clear file ownership. Keep urgent blocking work local.
|
|
20
|
+
10. Write `docs/plan/<topic>.md`.
|
|
21
|
+
11. Add the topic link and status to `PLAN.md`.
|
|
22
|
+
12. Put tool readiness, module acceptance verification, and surface integration verification on every module slice.
|
|
23
|
+
13. Use the OS locale for user-visible output unless the user asks for another language.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# cairn-review
|
|
2
|
+
|
|
3
|
+
Use the `cairn-review` skill.
|
|
4
|
+
|
|
5
|
+
Prerequisite: if `scripts/cairn doctor` fails, restore installation with `scripts/cairn install` or `scripts/cairn upgrade`.
|
|
6
|
+
|
|
7
|
+
Goal: review completed work against plan, memory, policy, and evidence.
|
|
8
|
+
|
|
9
|
+
Procedure:
|
|
10
|
+
|
|
11
|
+
1. Read the plan slice and memory inputs.
|
|
12
|
+
2. Check changed files, tool readiness evidence, and verification evidence.
|
|
13
|
+
3. Delegate independent read-only review to `explorer` when it materially improves speed or quality; use `worker` only for scoped verification reruns or QA artifacts.
|
|
14
|
+
4. Report findings first, ordered by severity, with file and line references. If no issues are found, say so clearly and mention remaining test gaps or residual risk.
|
|
15
|
+
5. Record review evidence in `docs/plan/<topic>.md`.
|
|
16
|
+
6. Use the OS locale for user-visible output unless the user asks for another language.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# cairn-toolcheck
|
|
2
|
+
|
|
3
|
+
Goal: detect repository stacks and check required LSP, typecheck, lint, dry-run, and verification tools.
|
|
4
|
+
|
|
5
|
+
From a globally installed package:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bunx cairn-ai@latest toolcheck
|
|
9
|
+
bunx cairn-ai@latest toolcheck --install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
From this repository:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
scripts/cairn toolcheck
|
|
16
|
+
scripts/cairn toolcheck --install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use `--install` when a required tool is missing. Record detected stacks, missing tools, install attempts, and blockers in the related `docs/plan/<topic>.md`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# cairn-uninstall
|
|
2
|
+
|
|
3
|
+
Goal: remove the Codex, Claude Code, and Antigravity entries installed by Cairn.
|
|
4
|
+
|
|
5
|
+
Run:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
scripts/cairn uninstall
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With the published package:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bunx cairn-ai@latest uninstall
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Removed items:
|
|
18
|
+
|
|
19
|
+
- Cairn marketplace, plugin, and hook trust state blocks in `~/.codex/config.toml`.
|
|
20
|
+
- `~/.codex/plugins/cache/cairn`.
|
|
21
|
+
- Claude Code `cairn-*` commands and agents mirror files.
|
|
22
|
+
- Antigravity IDE/CLI `cairn-*` skills and workflows mirror files.
|
|
23
|
+
|
|
24
|
+
The source work folder is not deleted.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# cairn-upgrade
|
|
2
|
+
|
|
3
|
+
Goal: update the Cairn installation from the current source.
|
|
4
|
+
|
|
5
|
+
Run:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
scripts/cairn upgrade
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With the published package:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bunx cairn-ai@latest upgrade
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Actions:
|
|
18
|
+
|
|
19
|
+
- Replace the Cairn installation in the Codex cache.
|
|
20
|
+
- Recompute hook trust state and update settings.
|
|
21
|
+
- Overwrite Claude Code mirror files with the latest content.
|
|
22
|
+
- Overwrite Antigravity IDE/CLI skills and workflows mirror files with the latest content.
|
|
23
|
+
- Create `*.cairn-backup-*` backups before changing settings.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# cairn-work
|
|
2
|
+
|
|
3
|
+
Use the `cairn-work` skill.
|
|
4
|
+
|
|
5
|
+
Prerequisite: if `scripts/cairn doctor` fails, restore installation with `scripts/cairn install` or `scripts/cairn upgrade`.
|
|
6
|
+
|
|
7
|
+
Goal: execute the next incomplete module slice in `PLAN.md`.
|
|
8
|
+
|
|
9
|
+
Procedure:
|
|
10
|
+
|
|
11
|
+
1. Read `PLAN.md`, the detailed plan, `MEMORY.md`, and relevant memory notes.
|
|
12
|
+
2. Read the Codex or Claude model guidance recorded in the plan.
|
|
13
|
+
3. Select one small module slice.
|
|
14
|
+
4. Confirm required tool readiness. If a required LSP/check tool is missing, run `scripts/cairn toolcheck --install` or a repository-native install command before accepting a fallback.
|
|
15
|
+
5. Confirm the complexity triage and selected Light/Heavy Path recorded in the plan.
|
|
16
|
+
6. For Light Path, implement directly or use one bounded `worker`, then run focused verification.
|
|
17
|
+
7. For Heavy Path, follow the plan's staged implementation and review gates without role-mapping shortcuts.
|
|
18
|
+
8. When delegating implementation to `worker`, state the file ownership clearly and tell the worker not to revert others' edits.
|
|
19
|
+
9. Re-run module acceptance verification.
|
|
20
|
+
10. Re-run surface integration verification.
|
|
21
|
+
11. Record tool readiness and verification evidence in `docs/plan/<topic>.md` and update `PLAN.md`.
|
|
22
|
+
12. Use the OS locale for user-visible output unless the user asks for another language.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Model Guidance
|
|
2
|
+
|
|
3
|
+
Cairn only applies model-specific adjustment to Claude-family and Codex-family models.
|
|
4
|
+
|
|
5
|
+
The goal is not to make prompts long by model. The goal is to stabilize the same `MEMORY.md`/`PLAN.md` flow according to model strengths.
|
|
6
|
+
|
|
7
|
+
## Application Order
|
|
8
|
+
|
|
9
|
+
1. Identify the active model name. If the model name is not directly exposed, infer it from the user's default model setting and agent role frontmatter.
|
|
10
|
+
2. For Claude-family models, apply `docs/model-guidance/claude.md`.
|
|
11
|
+
3. For Codex-family models, apply `docs/model-guidance/codex.md`.
|
|
12
|
+
4. If the model is not clearly classified, apply only the common rules and skip model-specific adjustment.
|
|
13
|
+
|
|
14
|
+
## Common Rules
|
|
15
|
+
|
|
16
|
+
- Keep root `MEMORY.md` and `PLAN.md` as indexes only.
|
|
17
|
+
- Keep detailed judgment in `docs/memory/`, `docs/plan/`, and `docs/model-guidance/`.
|
|
18
|
+
- Preserve proper nouns, file names, variable names, service names, alert names, MCP tool names, and agent names exactly as written.
|
|
19
|
+
- Select Light Path or Heavy Path before implementation.
|
|
20
|
+
- Detect required LSP, typecheck, lint, dry-run, and verification tools before implementation.
|
|
21
|
+
- Missing required tools must trigger a project-local, repository-native, or ephemeral install attempt before they can be treated as unavailable.
|
|
22
|
+
- Every implementation slice must pass module acceptance verification and surface integration verification.
|
|
23
|
+
- Before mutating external state, run the closest available dry-run, check, plan, diff, validate, or equivalent command.
|
|
24
|
+
- Limit each slice to two verification passes by default. After two failed passes, record the blocker or split the slice instead of continuing a repeated loop.
|
|
25
|
+
- User-visible output must follow the OS locale unless the user asks for another language.
|
|
26
|
+
|
|
27
|
+
## Delegation Defaults
|
|
28
|
+
|
|
29
|
+
- `explorer`: use for read-only codebase discovery, impact analysis, pattern searches, and read-only verification when available.
|
|
30
|
+
- `worker`: use for bounded implementation or verification tasks with clear file ownership.
|
|
31
|
+
- Main session: keep urgent blocking work local when the next step depends immediately on the result.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Claude Model Guidance
|
|
2
|
+
|
|
3
|
+
Claude-family models are strong at long-context retention, policy interpretation, and plan consistency review. In Cairn, use those strengths for planning, policy interpretation, and evidence review.
|
|
4
|
+
|
|
5
|
+
## Use Strengths
|
|
6
|
+
|
|
7
|
+
- Read policies across multiple documents and summarize conflicts.
|
|
8
|
+
- Judge domain boundaries, risk, rollback ability, and user impact.
|
|
9
|
+
- Check whether required LSP, typecheck, lint, dry-run, and verification tools were discovered and bootstrapped.
|
|
10
|
+
- Check whether `docs/plan/<topic>.md` is decision-complete.
|
|
11
|
+
- After implementation, confirm that evidence actually satisfies the plan's completion criteria.
|
|
12
|
+
|
|
13
|
+
## Adjustment Rules
|
|
14
|
+
|
|
15
|
+
- Do not bloat plans with long explanations. Keep decisions, rationale, and evidence.
|
|
16
|
+
- Preserve frequency words such as "all", "each", and "required". Do not handle only the first item and stop.
|
|
17
|
+
- Do not accept "tool missing" as a reason to skip precise codebase exploration until install or bootstrap has been attempted.
|
|
18
|
+
- Do not skip the two verification gates even on Light Path.
|
|
19
|
+
- Do not approve a plan that lacks dry-run or check evidence for external-state-changing work.
|
|
20
|
+
- Do not allow open-ended verification loops. Require a blocker or slice split after two failed passes.
|
|
21
|
+
- On Heavy Path, check plan gaps before implementation.
|
|
22
|
+
- Before asking the user, use repository evidence and available `explorer`/`worker` delegation when it materially improves speed or quality.
|
|
23
|
+
- Write user-visible output in the OS locale unless the user asks for another language.
|
|
24
|
+
|
|
25
|
+
## Path Guidance
|
|
26
|
+
|
|
27
|
+
### Policy And Risk
|
|
28
|
+
|
|
29
|
+
- Summarize domain boundaries and risk from repository evidence.
|
|
30
|
+
- If policy is unclear, propose candidates to record in `docs/memory/<domain>.md`.
|
|
31
|
+
- Clearly name risk signals that require Heavy Path.
|
|
32
|
+
|
|
33
|
+
### Planning
|
|
34
|
+
|
|
35
|
+
- Keep the plan short and executable.
|
|
36
|
+
- Always record complexity triage and the selected Light/Heavy Path.
|
|
37
|
+
- Always record tool readiness and blockers.
|
|
38
|
+
- Each module slice must include files, contract, dry-run or check command when applicable, module acceptance verification, and surface integration verification.
|
|
39
|
+
|
|
40
|
+
### Review
|
|
41
|
+
|
|
42
|
+
- Lead with findings.
|
|
43
|
+
- Do not approve without evidence.
|
|
44
|
+
- Check that missing tools have install-attempt evidence before approving a fallback.
|
|
45
|
+
- Check that dry-run or check evidence exists when external state could change.
|
|
46
|
+
- Prioritize proper noun preservation, plan scope drift, and missing verification.
|