cairn-ai 0.2.1 → 0.2.3
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-plan.md +11 -11
- package/.agents/workflows/cairn-work.md +10 -8
- package/.claude/commands/cairn-plan.md +1 -1
- package/.claude/commands/cairn-work.md +1 -1
- package/.codex-plugin/plugin.json +12 -18
- package/README.de.md +13 -11
- package/README.es.md +13 -11
- package/README.fr.md +13 -11
- package/README.ja.md +13 -11
- package/README.ko.md +15 -13
- package/README.md +15 -13
- package/README.pt.md +13 -11
- package/README.zh.md +13 -11
- package/commands/cairn-doctor.md +5 -3
- package/commands/cairn-install.md +5 -4
- package/commands/cairn-plan.md +13 -16
- package/commands/cairn-review.md +1 -1
- package/commands/cairn-uninstall.md +4 -2
- package/commands/cairn-upgrade.md +6 -6
- package/commands/cairn-work.md +12 -11
- package/docs/model-guidance/README.md +6 -2
- package/docs/model-guidance/codex.md +5 -0
- package/hooks/hooks.json +1 -1
- package/package.json +2 -2
- package/scripts/cairn-goal.mjs +522 -101
- package/scripts/cairn-lifecycle.mjs +926 -313
- package/scripts/cairn-safe-fs.mjs +246 -0
- package/scripts/cairn-state.mjs +80 -30
- package/scripts/cairn-state.sh +2 -0
- package/scripts/cairn-toolcheck.mjs +116 -34
- package/scripts/cairn.mjs +9 -8
- package/scripts/release-integrity-0.2.2.json +68 -0
- package/skills/cairn-plan/SKILL.md +23 -17
- package/skills/cairn-review/SKILL.md +1 -1
- package/skills/cairn-work/SKILL.md +39 -16
- package/templates/PLAN.md +1 -0
- package/templates/work-plan.md +23 -2
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ The core idea is to keep useful agent-harness behavior: hooks, persistent state,
|
|
|
19
19
|
|
|
20
20
|
Before a task mutates external state, Cairn records and runs the closest available dry-run or check mode. Verification is bounded: each task gets two verification passes by default, then the agent records a blocker or splits it into sub-tasks instead of continuing an open-ended loop.
|
|
21
21
|
|
|
22
|
-
Cairn also treats tool readiness as part of the work. LSP, typecheck, lint, dry-run, and verification tools are checked against the repository stack.
|
|
22
|
+
Cairn also treats tool readiness as part of the work. LSP, typecheck, lint, dry-run, and verification tools are checked against the repository stack. A missing tool is installed only after explicit approval and only when a pinned, supported installer exists; otherwise Cairn reports a blocker.
|
|
23
23
|
|
|
24
24
|
## LazyCodex Attribution
|
|
25
25
|
|
|
@@ -52,7 +52,7 @@ cairn toolcheck --install --yes --root .
|
|
|
52
52
|
|
|
53
53
|
- `toolcheck` reports detected stacks and missing tools.
|
|
54
54
|
- Default checks are read-only, bounded by a timeout, and do not execute repository-local wrappers merely to discover them.
|
|
55
|
-
- `toolcheck --install` requires both `--yes` and explicit user approval. Unpinned or checksum-free installers
|
|
55
|
+
- `toolcheck --install` requires both `--yes` and explicit user approval. Unpinned or checksum-free installers return the canonical `installer-unavailable` refusal rather than silently downloading `latest`.
|
|
56
56
|
- Cairn plans record detected stack, required tools, install commands, and blockers.
|
|
57
57
|
- A missing LSP server is not a valid reason to skip precise codebase exploration until installation or an equivalent symbol-aware fallback has been attempted.
|
|
58
58
|
|
|
@@ -81,7 +81,7 @@ The harness creates and maintains these files at the target repository root.
|
|
|
81
81
|
- `docs/memory/*.md`: detailed knowledge by domain.
|
|
82
82
|
- `PLAN.md`: short index of active and completed work topics.
|
|
83
83
|
- `docs/plan/*.md`: detailed execution plans.
|
|
84
|
-
- `.cairn/state.json`: git-ignored, versioned active goal/task/
|
|
84
|
+
- `.cairn/state.json`: git-ignored, versioned active goal/task/evidence-record state used for interruption recovery and scoped stop gates.
|
|
85
85
|
|
|
86
86
|
Runtime scripts, templates, commands, agents, and model guidance stay in the installed plugin root. Runtime locator files let Codex, Claude Code, and Antigravity share that installed copy without copying Cairn internals into the target repository.
|
|
87
87
|
|
|
@@ -108,20 +108,22 @@ cairn uninstall
|
|
|
108
108
|
cairn toolcheck
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
- `cairn install`: installs the
|
|
112
|
-
- `cairn upgrade`:
|
|
113
|
-
- `cairn doctor`:
|
|
114
|
-
- `cairn uninstall`: removes
|
|
115
|
-
- `cairn toolcheck`: detects repository stacks and checks
|
|
116
|
-
- `cairn goal ...`: starts, inspects, pauses, resumes, blocks, cancels, and completes a persisted repository goal;
|
|
111
|
+
- `cairn install`: transactionally installs the custom marketplace source, versioned Codex runtime cache, Cairn-owned config sections, Claude Code mirrors, and current Antigravity IDE/CLI skill surfaces.
|
|
112
|
+
- `cairn upgrade`: replaces only ownership-manifest entries whose installed digests still match, with staged validation and reverse-order rollback on failure.
|
|
113
|
+
- `cairn doctor`: validates the ownership manifest, managed digests, effective Codex features, actual installed/enabled/version plugin state, and mirror/runtime locators without repairing them.
|
|
114
|
+
- `cairn uninstall`: removes or restores only ownership-manifest entries that remain unmodified; modified or unmanaged targets are preserved as conflicts and failures roll back.
|
|
115
|
+
- `cairn toolcheck`: detects repository stacks and checks required LSP and verification tools; installation runs only for an approved supported installer.
|
|
116
|
+
- `cairn goal ...`: starts, inspects, pauses, resumes, blocks, cancels, and completes a persisted repository goal; the default tool-bound policy records successful evidence by executing `goal verify -- <argv>`. The legacy `goal receipt` command imports declared evidence only.
|
|
117
117
|
- `cairn-memory`: explores domain knowledge and updates `MEMORY.md`.
|
|
118
118
|
- `cairn-plan`: creates a decision-complete plan under `docs/plan/`.
|
|
119
119
|
- `cairn-work`: executes the next module task in the current `PLAN.md` with two verification gates.
|
|
120
120
|
- `cairn-review`: reviews completed tasks against plan, memory, and evidence.
|
|
121
121
|
|
|
122
|
-
On every `UserPromptSubmit`, Cairn injects model-visible guidance that an implementation or continued-execution request authorizes goal creation even if the user never says “goal.”
|
|
122
|
+
On every `UserPromptSubmit`, Cairn injects model-visible guidance that an implementation or continued-execution request authorizes goal creation even if the user never says “goal.” The agent first writes an initial repository plan with triage as the active task, then—before exploration or triage—shows the same roadmap through Codex `update_plan` and `create_goal` when available and starts the repository Cairn goal. Triage updates both plans to a decision-complete implementation revision before implementation begins. An active goal keeps the full ordered roadmap, statuses, and current task in hook context so a side question returns to the original work. Consultation, explanation, and plan-only requests remain goal-free.
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
For token-efficient execution, Cairn puts reasoning into a focused executable test contract—requirements, invariants, boundaries, and failure modes—before implementation. Implementation receives the failing contract and bounded file scope, then makes the minimum passing change. Tool exit codes and machine summaries decide success; successful output stays concise and only failures expand context. Verification climbs from focused tests to one final full check. Before package verification, inspect lifecycle scripts and run normal `npm pack --dry-run` by default: content-producing or unknown scripts must never use `--ignore-scripts`; only absent or proven content-neutral scripts may use it while the full-check evidence remains fresh. Successful state mutations support `--quiet` so growing goal JSON does not consume the conversation budget.
|
|
125
|
+
|
|
126
|
+
Install and upgrade keep the custom marketplace lifecycle; they do not invoke `codex plugin add`. Candidates are staged and validated before commit, every managed destination and digest is recorded in an ownership manifest, and committed phases roll back in reverse order on failure. An exact unmodified supported legacy installation can be adopted after release-integrity validation; modified or unknown artifacts are preserved and rejected. Cairn edits only its own TOML sections and never forces public feature or agent settings. The source plugin manifest stays validator-friendly; only the installed cache copy gets a `hooks` field. Lifecycle commands must run from the published/global package, not from the cached copy that they replace.
|
|
125
127
|
|
|
126
128
|
Codex uses `skills/` and `commands/`. Claude Code uses mirrored commands and agent definitions under `.claude/`. Antigravity uses `.agents/workflows` and global skills mirrors.
|
|
127
129
|
|
|
@@ -129,8 +131,8 @@ Codex uses `skills/` and `commands/`. Claude Code uses mirrored commands and age
|
|
|
129
131
|
|
|
130
132
|
Antigravity supports `SKILL.md`-based Agent Skills and Workflows invoked as `/workflow-name`. Cairn installs these paths for that surface.
|
|
131
133
|
|
|
132
|
-
- Antigravity IDE: `~/.
|
|
133
|
-
- Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn
|
|
134
|
+
- Antigravity IDE: `~/.gemini/config/skills/cairn-*/SKILL.md`.
|
|
135
|
+
- Antigravity CLI: flat `~/.gemini/antigravity-cli/skills/cairn-*.md` skill files.
|
|
134
136
|
|
|
135
137
|
Codex-only hooks are not ported to Antigravity. Instead, the same planning, memory, complexity triage, and two-gate verification procedures run through Skills and Workflows. Set `ANTIGRAVITY_HOME` or `ANTIGRAVITY_CLI_HOME` to override paths.
|
|
136
138
|
|
package/README.pt.md
CHANGED
|
@@ -11,7 +11,7 @@ A ideia central e manter comportamentos uteis de agent harness: hooks, estado pe
|
|
|
11
11
|
|
|
12
12
|
Antes que um task altere estado externo, Cairn registra e executa o dry-run ou check mode mais proximo disponivel. A verificacao e limitada: cada task recebe duas verification passes por padrao; depois, o agente registra um blocker ou divide o task em vez de continuar um loop aberto.
|
|
13
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.
|
|
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. A instalacao ocorre apenas com aprovacao explicita e um installer suportado e fixado; caso contrario, um blocker e informado.
|
|
15
15
|
|
|
16
16
|
## LazyCodex Attribution
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ cairn toolcheck --install --yes --root .
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
- `toolcheck` informa detected stacks e missing tools.
|
|
41
|
-
- `toolcheck --install`
|
|
41
|
+
- `toolcheck --install` exige aprovacao explicita e `--yes`; um installer sem suporte retorna o resultado canonico `installer-unavailable` sem ser executado.
|
|
42
42
|
- Os planos Cairn registram detected stack, required tools, install commands e blockers.
|
|
43
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
44
|
|
|
@@ -65,12 +65,14 @@ O harness cria e mantem estes arquivos na raiz do repositorio alvo.
|
|
|
65
65
|
|
|
66
66
|
- `MEMORY.md`: indice curto de persistent domain knowledge.
|
|
67
67
|
- `docs/memory/*.md`: conhecimento detalhado por dominio.
|
|
68
|
-
- `.cairn/state.json`: estado git-ignored de goal, task e
|
|
68
|
+
- `.cairn/state.json`: estado git-ignored de goal, task e evidence record para retomada e stop gates com escopo.
|
|
69
69
|
- `PLAN.md`: indice curto de active and completed work topics.
|
|
70
70
|
- `docs/plan/*.md`: detailed execution plans.
|
|
71
71
|
|
|
72
72
|
Arquivos raiz ficam curtos e os detalhes vao para `docs/`, para que agentes leiam apenas o contexto necessario.
|
|
73
73
|
|
|
74
|
+
Para economizar tokens, crie primeiro um test contract com requisitos, invariantes, limites e modos de falha. Use o tool exit code de `goal verify -- <argv>` como autoridade, resuma o sucesso e expanda o contexto apenas em falhas. Inspecione o package lifecycle e execute normalmente `npm pack --dry-run`. Scripts content-producing ou desconhecidos nunca devem usar `--ignore-scripts`; use-o apenas quando os scripts estiverem ausentes ou comprovadamente content-neutral e a evidencia do full check continuar atual.
|
|
75
|
+
|
|
74
76
|
## Commands
|
|
75
77
|
|
|
76
78
|
O pacote publicado pode ser executado com `bunx` ou comandos `cairn` instalados globalmente.
|
|
@@ -94,17 +96,17 @@ cairn uninstall
|
|
|
94
96
|
cairn toolcheck
|
|
95
97
|
```
|
|
96
98
|
|
|
97
|
-
- `cairn install`: instala
|
|
98
|
-
- `cairn upgrade`:
|
|
99
|
-
- `cairn doctor`:
|
|
100
|
-
- `cairn uninstall`: remove
|
|
101
|
-
- `cairn toolcheck`: detecta repository stacks e verifica
|
|
99
|
+
- `cairn install`: instala de forma transacional custom marketplace source, versioned runtime, secoes config do Cairn e mirrors atuais.
|
|
100
|
+
- `cairn upgrade`: substitui apenas entradas intactas do ownership manifest apos staged validation e usa rollback em falhas.
|
|
101
|
+
- `cairn doctor`: valida ownership digests, features efetivos do Codex, status real do plugin e runtime locators sem reparar.
|
|
102
|
+
- `cairn uninstall`: remove apenas entradas gerenciadas intactas; alvos modified ou unmanaged sao preservados como conflict.
|
|
103
|
+
- `cairn toolcheck`: detecta repository stacks e verifica required tools; apenas um installer suportado e aprovado e executado, caso contrario `installer-unavailable`.
|
|
102
104
|
- `cairn-memory`: explora domain knowledge e atualiza `MEMORY.md`.
|
|
103
105
|
- `cairn-plan`: cria um decision-complete plan em `docs/plan/`.
|
|
104
106
|
- `cairn-work`: executa o proximo module task no `PLAN.md` atual com dois verification gates.
|
|
105
107
|
- `cairn-review`: revisa completed tasks contra plan, memory e evidence.
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
O custom marketplace lifecycle separa source e versioned runtime. Staged validation precede cada commit, o ownership manifest vincula todos os managed digests e uma falha aciona reverse-order rollback. Artifacts modified ou unmanaged sao preserved e relatados como conflict. O Cairn altera apenas suas TOML sections e nao forca feature/agent settings publicos.
|
|
108
110
|
|
|
109
111
|
Codex usa `skills/` e `commands/`. Claude Code usa comandos espelhados e agent definitions em `.claude/`. Antigravity usa `.agents/workflows` e global skills mirrors.
|
|
110
112
|
|
|
@@ -112,8 +114,8 @@ Codex usa `skills/` e `commands/`. Claude Code usa comandos espelhados e agent d
|
|
|
112
114
|
|
|
113
115
|
Antigravity suporta Agent Skills e Workflows baseados em `SKILL.md` chamados como `/workflow-name`. Cairn instala estes paths para essa superficie.
|
|
114
116
|
|
|
115
|
-
- Antigravity IDE: `~/.
|
|
116
|
-
- Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn
|
|
117
|
+
- Antigravity IDE: `~/.gemini/config/skills/cairn-*/SKILL.md`.
|
|
118
|
+
- Antigravity CLI: arquivos skill planos em `~/.gemini/antigravity-cli/skills/cairn-*.md`.
|
|
117
119
|
|
|
118
120
|
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
121
|
|
package/README.zh.md
CHANGED
|
@@ -11,7 +11,7 @@ Cairn 的核心思路是保留有用的 agent harness 行为:hooks、persisten
|
|
|
11
11
|
|
|
12
12
|
在 task 修改外部状态之前,Cairn 会记录并运行最接近的 dry-run 或 check mode。verification 是有边界的:默认每个 task 有两次 verification pass,然后 agent 会记录 blocker 或拆分 task,而不是继续开放式循环。
|
|
13
13
|
|
|
14
|
-
Cairn 也把 tool readiness 视为工作的一部分。它会根据 repository stack 检查 LSP、typecheck、lint、dry-run 和 verification tools
|
|
14
|
+
Cairn 也把 tool readiness 视为工作的一部分。它会根据 repository stack 检查 LSP、typecheck、lint、dry-run 和 verification tools。只有在获得明确批准且存在固定版本的受支持 installer 时才安装,否则报告 blocker。
|
|
15
15
|
|
|
16
16
|
## LazyCodex Attribution
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ cairn toolcheck --install --yes --root .
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
- `toolcheck` 报告 detected stacks 和 missing tools。
|
|
41
|
-
- `toolcheck --install`
|
|
41
|
+
- `toolcheck --install` 要求明确批准和 `--yes`;不受支持的 installer 不会执行,并返回 canonical `installer-unavailable`。
|
|
42
42
|
- Cairn plans 会记录 detected stack、required tools、install commands 和 blockers。
|
|
43
43
|
- 缺少 LSP server 不能作为跳过 precise codebase exploration 的理由,除非已尝试 installation 或等价的 symbol-aware fallback。
|
|
44
44
|
|
|
@@ -65,12 +65,14 @@ harness 会在目标 repository root 创建并维护这些文件。
|
|
|
65
65
|
|
|
66
66
|
- `MEMORY.md`: persistent domain knowledge 的短索引。
|
|
67
67
|
- `docs/memory/*.md`: 按 domain 记录的详细 knowledge。
|
|
68
|
-
- `.cairn/state.json`: 用于中断恢复和 scoped stop gate 的 git-ignored goal/task/
|
|
68
|
+
- `.cairn/state.json`: 用于中断恢复和 scoped stop gate 的 git-ignored goal/task/evidence-record 状态。
|
|
69
69
|
- `PLAN.md`: active 和 completed work topics 的短索引。
|
|
70
70
|
- `docs/plan/*.md`: detailed execution plans。
|
|
71
71
|
|
|
72
72
|
root files 保持简短,细节移到 `docs/` 下,让 agents 只读取当前任务需要的 context。
|
|
73
73
|
|
|
74
|
+
为节省 token,先把需求、不变量、边界和失败模式写成 test contract。以 `goal verify -- <argv>` 的 tool exit code 为判定依据,成功时保持简短,只在失败时扩展 context。检查 package lifecycle,并默认运行正常的 `npm pack --dry-run`。content-producing 或未知 script 不得使用 `--ignore-scripts`;只有 script 不存在或已证明为 content-neutral,且 full-check evidence 仍然新鲜时才可使用。
|
|
75
|
+
|
|
74
76
|
## Commands
|
|
75
77
|
|
|
76
78
|
发布后的 package 可以通过 `bunx` 或全局安装的 `cairn` commands 执行。
|
|
@@ -94,17 +96,17 @@ cairn uninstall
|
|
|
94
96
|
cairn toolcheck
|
|
95
97
|
```
|
|
96
98
|
|
|
97
|
-
- `cairn install`:
|
|
98
|
-
- `cairn upgrade`:
|
|
99
|
-
- `cairn doctor`:
|
|
100
|
-
- `cairn uninstall`:
|
|
101
|
-
- `cairn toolcheck`: 检测 repository stacks
|
|
99
|
+
- `cairn install`: 以事务方式安装 custom marketplace source、versioned runtime、Cairn-owned config sections 和当前 host mirrors。
|
|
100
|
+
- `cairn upgrade`: staged validation 后只替换 ownership manifest 中未修改的 entry,失败时 rollback。
|
|
101
|
+
- `cairn doctor`: 只读验证 ownership digests、effective Codex features、真实 plugin status 和 runtime locators。
|
|
102
|
+
- `cairn uninstall`: 只删除未修改的 managed entry;modified 或 unmanaged target 会 preserve 并报告 conflict。
|
|
103
|
+
- `cairn toolcheck`: 检测 repository stacks 和 required tools;只执行已批准的 supported installer,否则返回 `installer-unavailable`。
|
|
102
104
|
- `cairn-memory`: 探索 domain knowledge 并更新 `MEMORY.md`。
|
|
103
105
|
- `cairn-plan`: 在 `docs/plan/` 下创建 decision-complete plan。
|
|
104
106
|
- `cairn-work`: 执行当前 `PLAN.md` 中的下一个 module task,并收集两个 verification gates。
|
|
105
107
|
- `cairn-review`: 根据 plan、memory 和 evidence review completed tasks。
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
custom marketplace lifecycle 将 source 与 versioned runtime 分离。每次 commit 前执行 staged validation,ownership manifest 绑定全部 managed digests,失败时执行 reverse-order rollback。modified 或 unmanaged artifacts 会 preserve 并报告 conflict。Cairn 只修改自身 TOML sections,不强制 public feature/agent settings。
|
|
108
110
|
|
|
109
111
|
Codex 使用 `skills/` 和 `commands/`。Claude Code 使用 `.claude/` 下的 mirrored commands 和 agent definitions。Antigravity 使用 `.agents/workflows` 和 global skills mirrors。
|
|
110
112
|
|
|
@@ -112,8 +114,8 @@ Codex 使用 `skills/` 和 `commands/`。Claude Code 使用 `.claude/` 下的 mi
|
|
|
112
114
|
|
|
113
115
|
Antigravity 支持通过 `/workflow-name` 调用的 `SKILL.md` based Agent Skills and Workflows。Cairn 会为该 surface 安装这些 paths。
|
|
114
116
|
|
|
115
|
-
- Antigravity IDE: `~/.
|
|
116
|
-
- Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn
|
|
117
|
+
- Antigravity IDE: `~/.gemini/config/skills/cairn-*/SKILL.md`。
|
|
118
|
+
- Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn-*.md` 下的扁平 skill 文件。
|
|
117
119
|
|
|
118
120
|
Codex-only hooks 不会移植到 Antigravity。相同的 planning、memory、complexity triage 和 two-gate verification procedures 会通过 Skills 和 Workflows 运行。设置 `ANTIGRAVITY_HOME` 或 `ANTIGRAVITY_CLI_HOME` 可以覆盖 paths。
|
|
119
121
|
|
package/commands/cairn-doctor.md
CHANGED
|
@@ -8,15 +8,17 @@ Run from the published or global package:
|
|
|
8
8
|
bunx cairn-ai@latest doctor
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
The doctor validates the custom marketplace installation and ownership manifest without repairing it. Diagnostics are read-only; rollback is performed only by lifecycle transaction recovery.
|
|
12
|
+
|
|
11
13
|
Checks:
|
|
12
14
|
|
|
13
15
|
- Source plugin manifest.
|
|
14
16
|
- Codex cached installation.
|
|
15
17
|
- Marketplace file.
|
|
16
18
|
- Hook manifest link in the installed copy.
|
|
17
|
-
-
|
|
18
|
-
- `
|
|
19
|
-
-
|
|
19
|
+
- ownership manifest presence and managed destination digests.
|
|
20
|
+
- `cairn@cairn` installed/enabled/version from the actual Codex CLI.
|
|
21
|
+
- effective Codex plugin/hook/multi-agent feature state (reported, never forced).
|
|
20
22
|
- hook trust state.
|
|
21
23
|
- Claude Code commands and agents mirror files.
|
|
22
24
|
- Antigravity IDE/CLI skills and workflows mirror files.
|
|
@@ -8,14 +8,15 @@ Run from the published or global package, not from the installed cache copy:
|
|
|
8
8
|
bunx cairn-ai@latest install
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
The current custom lifecycle remains in use
|
|
11
|
+
The current custom marketplace lifecycle remains in use; this is not a migration to `codex plugin add`. Do not invoke lifecycle install/upgrade from the cached plugin root because that copy is the replacement target.
|
|
12
12
|
|
|
13
13
|
Actions:
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- Stage and validate the Cairn installation, then transactionally commit the custom marketplace source and versioned runtime cache.
|
|
16
16
|
- Add the `hooks/hooks.json` link to the installed manifest.
|
|
17
|
-
- Register marketplace, plugin, and hook trust
|
|
17
|
+
- Register only Cairn-owned marketplace, plugin, and hook trust sections in `~/.codex/config.toml`; do not rewrite public feature or agent settings.
|
|
18
18
|
- Install `cairn-*` commands and agents mirror files for Claude Code.
|
|
19
19
|
- Install `cairn-*` skills and workflows mirror files for Antigravity IDE/CLI.
|
|
20
20
|
- Write runtime locators so all mirrors resolve scripts, templates, and model guidance from the installed plugin root.
|
|
21
|
-
-
|
|
21
|
+
- Record every managed destination and digest in the ownership manifest under the custom marketplace, and rollback committed phases in reverse order on failure.
|
|
22
|
+
- Adopt an exact, unmodified supported legacy install only after release-integrity validation; preserve and reject modified or unknown artifacts.
|
package/commands/cairn-plan.md
CHANGED
|
@@ -4,24 +4,21 @@ Use the `cairn-plan` skill.
|
|
|
4
4
|
|
|
5
5
|
Prerequisite: resolve the installed Cairn runtime from the plugin or skill locator. If `cairn doctor` fails, restore it with the published/global lifecycle command. Never look for Cairn scripts, templates, or model guidance in the target repository.
|
|
6
6
|
|
|
7
|
-
Goal:
|
|
7
|
+
Goal: show an initial plan and goal before triage can be interrupted, then leave a decision-complete implementation plan before non-trivial implementation.
|
|
8
8
|
|
|
9
9
|
Procedure:
|
|
10
10
|
|
|
11
11
|
1. Every agent must read the project-root `MEMORY.md` for domain knowledge and repository policy before repository exploration, tool selection, work, or delegation.
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
14
|
-
4.
|
|
15
|
-
5.
|
|
16
|
-
6.
|
|
17
|
-
7.
|
|
18
|
-
8.
|
|
12
|
+
2. For implementation or continued execution, write an initial `docs/plan/<topic>.md` and `PLAN.md` entry from the request and `MEMORY.md`. Make `triage-plan` the first active task and specify its investigation scope, path-decision criteria, plan-update condition, and anticipated implementation/verification stages. This initial plan must be decision-complete for triage and explicitly not implementation-ready.
|
|
13
|
+
3. Before repository exploration, toolcheck, complexity triage, delegation, or a non-blocking user question, call Codex `update_plan` and then `create_goal` when those UI tools are available. Mirror the same roadmap into the repository Cairn goal. Record unavailable UI tools instead of silently implying UI synchronization. Skip goal activation for consultation, explanation, and plan-only requests.
|
|
14
|
+
4. Read relevant `docs/memory/*.md` as directed by the initial triage task.
|
|
15
|
+
5. Read the applicable installed model guidance.
|
|
16
|
+
6. Run the installed runtime's `toolcheck --root <repoRoot>` and handle missing tools through the explicit approval policy.
|
|
17
|
+
7. Explore the repository according to the initial triage task before asking the user.
|
|
18
|
+
8. Understand the whole work and affected surfaces, classify it into executable tasks/sub-tasks, run Light/Heavy Path triage, and update the same repository plan and Codex `update_plan` roadmap to a decision-complete implementation plan.
|
|
19
19
|
9. Use Light Path by default unless a Heavy Path condition clearly applies.
|
|
20
|
-
10.
|
|
21
|
-
11.
|
|
22
|
-
12.
|
|
23
|
-
13.
|
|
24
|
-
14.
|
|
25
|
-
15. Put the selected Light/Heavy Path, checked Heavy Path signals, tool readiness, module acceptance verification, and surface integration verification on every module task.
|
|
26
|
-
16. For Heavy Path, include an explicit automated test command and `Tests:` evidence line; Heavy Path completion must not rely on generic verification wording alone.
|
|
27
|
-
17. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
|
|
20
|
+
10. Apply delegation and orchestration policy only after the route is recorded. If subagent tools are unavailable or disallowed by a higher-priority policy, the main agent takes over and records it.
|
|
21
|
+
11. Do not begin implementation until the updated plan records selected path, checked Heavy Path signals, tool readiness, file scope, dry-run/check, module acceptance, surface integration, stable IDs, and fail-closed evidence.
|
|
22
|
+
12. For Heavy Path, include an explicit automated test command and `Tests:` evidence line.
|
|
23
|
+
13. Keep the repository goal and Codex UI plan statuses synchronized as triage and later tasks advance. Advance a UI step only after the matching repository Cairn task transition succeeds with its required bound evidence records.
|
|
24
|
+
14. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
|
package/commands/cairn-review.md
CHANGED
|
@@ -12,5 +12,5 @@ Procedure:
|
|
|
12
12
|
2. Check changed files, tool readiness evidence, and verification evidence.
|
|
13
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. When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents. Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, and preserve others' edits.
|
|
14
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` and as the goal-level final review
|
|
15
|
+
5. Record review evidence in `docs/plan/<topic>.md` and as the goal-level final review evidence record before completing the goal.
|
|
16
16
|
6. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
|
|
@@ -8,11 +8,13 @@ Run from the published or global package:
|
|
|
8
8
|
bunx cairn-ai@latest uninstall
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The custom marketplace ownership manifest is authoritative. Uninstall removes or restores only destinations whose current digest still matches the recorded installed digest; modified or unmanaged targets are preserved as conflicts. A failure rolls back the transaction.
|
|
12
|
+
|
|
13
|
+
Managed items:
|
|
12
14
|
|
|
13
15
|
- Cairn marketplace, plugin, and hook trust state blocks in `~/.codex/config.toml`.
|
|
14
16
|
- `~/.codex/plugins/cache/cairn`.
|
|
15
17
|
- Claude Code `cairn-*` commands and agents mirror files.
|
|
16
18
|
- Antigravity IDE/CLI `cairn-*` skills and workflows mirror files.
|
|
17
19
|
|
|
18
|
-
The source work folder is not deleted.
|
|
20
|
+
The source work folder is not deleted. The custom marketplace root is removed last, after external mirrors and config have committed successfully.
|
|
@@ -8,13 +8,13 @@ Run from the published or global package, not from the installed cache copy:
|
|
|
8
8
|
bunx cairn-ai@latest upgrade
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
The current custom lifecycle remains in use. The cached plugin root is a replacement target and must not upgrade itself.
|
|
11
|
+
The current custom marketplace lifecycle remains in use. The cached plugin root is a replacement target and must not upgrade itself.
|
|
12
12
|
|
|
13
13
|
Actions:
|
|
14
14
|
|
|
15
|
-
- Replace the
|
|
16
|
-
- Recompute hook trust state
|
|
17
|
-
-
|
|
18
|
-
- Overwrite Antigravity IDE/CLI skills and workflows mirror files with the latest content.
|
|
15
|
+
- Replace only files tracked by the ownership manifest whose current digest still matches the installed digest.
|
|
16
|
+
- Recompute Cairn-owned hook trust state without rewriting public feature or agent settings.
|
|
17
|
+
- Replace owned Claude Code and Antigravity mirror files with the latest content.
|
|
19
18
|
- Refresh runtime locators for every installed surface.
|
|
20
|
-
-
|
|
19
|
+
- Stage and validate all candidates before commit; rollback committed phases in reverse order on failure.
|
|
20
|
+
- Preserve and report a conflict for modified, unmanaged, or invalid legacy artifacts.
|
package/commands/cairn-work.md
CHANGED
|
@@ -14,14 +14,15 @@ Procedure:
|
|
|
14
14
|
4. Read Cairn goal status and select only its current task. If implementation was requested but no goal exists, create it from the decision-complete plan.
|
|
15
15
|
5. Confirm required tool readiness. If a required LSP/check tool is missing, report it and obtain explicit user approval before `toolcheck --install --yes` or a repository-native install command.
|
|
16
16
|
6. Confirm the complexity triage and selected Light/Heavy Path recorded in the plan. If missing, update the plan before mutating files.
|
|
17
|
-
7.
|
|
18
|
-
8. For
|
|
19
|
-
9.
|
|
20
|
-
10.
|
|
21
|
-
11.
|
|
22
|
-
12.
|
|
23
|
-
13.
|
|
24
|
-
14.
|
|
25
|
-
15.
|
|
26
|
-
16.
|
|
27
|
-
17.
|
|
17
|
+
7. Before implementation, spend reasoning on a focused executable test contract covering requirements, invariants, boundaries, and failure modes. Confirm the intended failure, then constrain implementation to the minimum change that passes it.
|
|
18
|
+
8. For Light Path, keep the main agent in the orchestrator role and use one bounded `worker` when allowed; for Heavy Path, follow the recorded staged review gates.
|
|
19
|
+
9. Give implementation the test contract, failing evidence, exact file ownership, and constraints. Require minimal implementation and no repeated broad discovery. Preserve status, final-report, close-and-review, recursive bounded delegation, and main-agent fallback rules.
|
|
20
|
+
10. Treat tool exit codes and bounded summaries as authoritative. Keep success output concise; expand only the failing test and related code context.
|
|
21
|
+
11. For Heavy Path, run the recorded automated test command and record explicit `Tests:` evidence.
|
|
22
|
+
12. Run focused module acceptance, then one final surface integration check through `goal verify -- ...`. Verification defaults to 600,000 ms (10 minutes), may be shortened with `--timeout-ms`, and is capped at 3,600,000 ms (1 hour). The command runs without holding the state lock; evidence is recorded only if the starting goal/task identity and the pre/post watched fingerprint still match.
|
|
23
|
+
13. Before package verification, inspect package lifecycle scripts. Run normal `npm pack --dry-run` by default. Content-producing or unknown lifecycle scripts must never use `--ignore-scripts`; only absent or proven content-neutral scripts may use it when the prior full check remains fresh.
|
|
24
|
+
14. Record evidence at the semantic boundary that proves the claimed behavior, bound to goal/task/plan. Missing, failed, skipped, stale, or placeholder evidence never completes work; relevant mutation invalidates affected evidence.
|
|
25
|
+
15. Complete the task and continue the goal. Use `--quiet` on successful state mutations; workers report only their assigned task and never select the next one.
|
|
26
|
+
16. Update the plan, goal state, and `PLAN.md` only after evidence exists.
|
|
27
|
+
17. Answer side questions briefly and resume unless explicitly asked to pause, stop, or switch.
|
|
28
|
+
18. Use the OS locale for user-visible responses and generated or updated documentation, plans, and memory artifacts unless the user asks for another language.
|
|
@@ -25,8 +25,12 @@ The goal is not to make prompts long by model. The goal is to stabilize the same
|
|
|
25
25
|
- If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
|
|
26
26
|
- Detect required LSP, typecheck, lint, dry-run, and verification tools before implementation.
|
|
27
27
|
- Missing required tools must be reported with a proposed install. Installation requires explicit user approval and a pinned/supported installer.
|
|
28
|
-
- Treat every implementation or continued-execution request as authorization to bind active work to a persisted Cairn goal and stable task IDs, even when the user does not mention a goal.
|
|
29
|
-
- Treat missing, failed, skipped, stale, or placeholder evidence as failure. Task
|
|
28
|
+
- Treat every implementation or continued-execution request as authorization to bind active work to a persisted Cairn goal and stable task IDs, even when the user does not mention a goal. After MEMORY.md, first write an initial plan that makes triage the active task. Before exploration or triage, synchronize its roadmap to Codex `update_plan` and `create_goal` when available and to the repository Cairn goal. Update both plans after triage, and implement only from the decision-complete revision. Exclude consultation, explanation, and plan-only requests.
|
|
29
|
+
- Treat missing, failed, skipped, stale, or placeholder evidence as failure. Task evidence records must be bound to the current goal, task, and plan.
|
|
30
|
+
- Treat the repository Cairn state as the fail-closed transition authority. Advance the matching Codex UI plan step only after the evidence-gated repository task transition succeeds.
|
|
31
|
+
- Spend reasoning on a focused executable test contract before implementation: requirements, invariants, boundaries, and failure modes. Give implementation only that contract, failing evidence, file scope, and constraints; require the minimum passing change.
|
|
32
|
+
- Run verification through `goal verify -- ...`; its default timeout is 600,000 ms and its maximum is 3,600,000 ms. Treat tool exit codes and bounded machine summaries as authoritative. Record evidence only when the starting goal/task identity and pre/post watched fingerprint still match, and choose the watch set and command at the semantic boundary that proves the claim. Compress success output and expand context only for failing tests and related code.
|
|
33
|
+
- Use a verification ladder: focused contract tests, one full check after the final change, then package dry-run while the full check remains fresh. Inspect package lifecycle scripts first and run normal `npm pack --dry-run` by default. Content-producing or unknown lifecycle scripts must never use `--ignore-scripts`; only absent or proven content-neutral scripts may use it.
|
|
30
34
|
- Every implementation task must pass module acceptance verification and surface integration verification.
|
|
31
35
|
- Before mutating external state, run the closest available dry-run, check, plan, diff, validate, or equivalent command.
|
|
32
36
|
- Limit each task to two verification passes by default. After two failed passes, record the blocker or split it into sub-tasks instead of continuing a repeated loop.
|
|
@@ -31,6 +31,8 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
|
|
|
31
31
|
|
|
32
32
|
### Planning
|
|
33
33
|
|
|
34
|
+
- Use `update_plan` to display the initial triage roadmap before repository exploration, then use `create_goal` when exposed so the Codex UI has an active goal before the turn can be interrupted.
|
|
35
|
+
- Treat the initial plan as decision-complete for its `triage-plan` task, not as authorization to implement. After triage, update the same repository plan and `update_plan` roadmap to the decision-complete implementation revision.
|
|
34
36
|
- On Light Path, write explicit task contracts when a plan artifact exists.
|
|
35
37
|
- Record detected stack, required tools, install commands, and tool blockers.
|
|
36
38
|
- Specify file scope and verification commands so implementation does not need to rediscover them.
|
|
@@ -39,6 +41,8 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
|
|
|
39
41
|
|
|
40
42
|
### Implementation
|
|
41
43
|
|
|
44
|
+
- Invest Codex reasoning in executable test design first, then hand the bounded failing contract to implementation and require the minimum passing patch.
|
|
45
|
+
- Run verification through `goal verify -- ...`. Its default timeout is 600,000 ms (10 minutes), capped at 3,600,000 ms (1 hour). On success, retain exact argv, tool exit code, pass count, output digest, and watched-workspace fingerprint; commit evidence only when the starting goal/task identity and pre/post watched fingerprint match. Choose the watch set and command at the semantic boundary that proves the claim. Expand diagnostics only for the failing test and its related file/symbol scope; reject stale evidence after related changes.
|
|
42
46
|
- If acting as the user-called/main agent, orchestrate the work and delegate actual implementation edits to `worker` whenever subagent tools are available, regardless of Light Path or Heavy Path.
|
|
43
47
|
- If acting as the user-called/main agent, immediately relay received subagent status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion.
|
|
44
48
|
- If acting as the user-called/main agent, close or release completed subagents after capturing their final report and evidence, then review the final report and evidence before marking the work complete.
|
|
@@ -46,6 +50,7 @@ Codex-family models are strong at small implementation tasks, explicit tool use,
|
|
|
46
50
|
- Confirm required tools are available. Install or bootstrap missing required tools before implementation.
|
|
47
51
|
- Run the recorded dry-run or check command before external-state mutation when applicable.
|
|
48
52
|
- After changes, run both module acceptance verification and surface integration verification.
|
|
53
|
+
- Inspect package lifecycle scripts before package verification. Run normal `npm pack --dry-run` by default; content-producing or unknown lifecycle scripts must never use `--ignore-scripts`, while absent or proven content-neutral scripts may use it only when the prior full check remains fresh.
|
|
49
54
|
- If a gate fails, diagnose once, shrink the task or split it into sub-tasks, and rerun both gates. Stop after the second failed pass and record the blocker.
|
|
50
55
|
- Return evidence in a form that can be recorded in `docs/plan/<topic>.md`.
|
|
51
56
|
|
package/hooks/hooks.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"type": "command",
|
|
33
33
|
"command": "node \"${PLUGIN_ROOT}/scripts/cairn-state.mjs\" post-tool-use",
|
|
34
34
|
"timeout": 10,
|
|
35
|
-
"statusMessage": "Cairn: reminding current goal
|
|
35
|
+
"statusMessage": "Cairn: reminding current goal evidence requirements"
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cairn-ai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Token-efficient agent harness with tool readiness for Codex, Claude Code, and Antigravity",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"README.*.md"
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
|
-
"check": "node --check scripts/cairn.mjs && node --check scripts/cairn-paths.mjs && node --check scripts/cairn-goal.mjs && node --check scripts/cairn-state.mjs && node --check scripts/cairn-lifecycle.mjs && node --check scripts/cairn-toolcheck.mjs && node -e \"JSON.parse(require('node:fs').readFileSync('package.json','utf8')); JSON.parse(require('node:fs').readFileSync('.codex-plugin/plugin.json','utf8')); JSON.parse(require('node:fs').readFileSync('hooks/hooks.json','utf8'))\" && npm test",
|
|
42
|
+
"check": "node --check scripts/cairn.mjs && node --check scripts/cairn-paths.mjs && node --check scripts/cairn-safe-fs.mjs && node --check scripts/cairn-goal.mjs && node --check scripts/cairn-state.mjs && node --check scripts/cairn-lifecycle.mjs && node --check scripts/cairn-toolcheck.mjs && node -e \"JSON.parse(require('node:fs').readFileSync('package.json','utf8')); JSON.parse(require('node:fs').readFileSync('.codex-plugin/plugin.json','utf8')); JSON.parse(require('node:fs').readFileSync('hooks/hooks.json','utf8')); JSON.parse(require('node:fs').readFileSync('scripts/release-integrity-0.2.2.json','utf8'))\" && npm test",
|
|
43
43
|
"test": "node --test",
|
|
44
44
|
"prepack": "npm run check"
|
|
45
45
|
},
|