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/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. If a required tool is missing, Cairn attempts project-local or repository-native installation before accepting a fallback.
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 are unavailable rather than silently downloading `latest`.
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/receipt state used for interruption recovery and scoped stop gates.
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 plugin into the Codex marketplace cache and configures Codex multi-agent settings, hook trust state, Claude Code mirror files, and Antigravity skills/workflows.
112
- - `cairn upgrade`: updates the installation, Codex multi-agent settings, hook trust state, Claude Code mirror files, and Antigravity skills/workflows from the current source.
113
- - `cairn doctor`: diagnoses Codex settings, installation, hook trust state, Claude Code mirror files, and Antigravity mirror files.
114
- - `cairn uninstall`: removes Cairn-added Codex settings, cache, Claude Code mirror files, and Antigravity mirror files.
115
- - `cairn toolcheck`: detects repository stacks and checks or installs required LSP and verification tools.
116
- - `cairn goal ...`: starts, inspects, pauses, resumes, blocks, cancels, and completes a persisted repository goal; task completion requires bound successful receipts.
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.” An active goal also injects its full ordered task roadmap, task statuses, and current task so the agent can answer a side question and return to the original work. The agent creates or attaches the goal after a decision-complete plan and before implementation, while consultation, explanation, and plan-only requests remain goal-free.
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
- Install and upgrade create `*.cairn-backup-*` backups before modifying `~/.codex/config.toml`. They also write runtime locators for every surface. The source plugin manifest stays validator-friendly; only the installed cache copy gets a `hooks` field to activate Codex hooks. The current custom lifecycle remains in use; lifecycle upgrade should run from the published/global package, not from the cached copy that it replaces.
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: `~/.agents/skills/cairn-*`, `~/.agents/workflows/cairn-*.md`.
133
- - Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn-*`, `~/.gemini/antigravity-cli/workflows/cairn-*.md`.
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. Se uma ferramenta obrigatoria estiver ausente, Cairn tenta uma instalacao project-local ou repository-native antes de aceitar um fallback.
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` 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`.
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 receipt para retomada e stop gates com escopo.
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 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.
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
- `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.
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: `~/.agents/skills/cairn-*`, `~/.agents/workflows/cairn-*.md`.
116
- - Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn-*`, `~/.gemini/antigravity-cli/workflows/cairn-*.md`.
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。如果缺少必要工具,Cairn 会先尝试 project-local 或 repository-native installation,再接受 fallback。
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` 尝试最接近的 project-local 或 repository-native install path,例如 package-manager dev dependencies、Composer dev dependencies、`uv`、Java LSP bootstrap、`go install` 或 `rustup component add`。
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/receipt 状态。
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`: 将 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。
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
- `install` 和 `upgrade` 在修改 `~/.codex/config.toml` 前会创建 `*.cairn-backup-*` backups。source plugin manifest 保持 validator-friendly;只有 installed cache copy 会添加启用 Codex hooks 的 `hooks` field。
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: `~/.agents/skills/cairn-*`, `~/.agents/workflows/cairn-*.md`.
116
- - Antigravity CLI: `~/.gemini/antigravity-cli/skills/cairn-*`, `~/.gemini/antigravity-cli/workflows/cairn-*.md`.
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
 
@@ -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
- - `features.plugins`, `features.plugin_hooks`, `features.multi_agent`.
18
- - `agents.max_depth`.
19
- - `cairn@cairn` plugin enabled.
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. Do not invoke lifecycle install/upgrade from the cached plugin root because that copy is the replacement target.
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
- - Copy the Cairn installation into the Codex marketplace cache.
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 state in `~/.codex/config.toml`.
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
- - Create `*.cairn-backup-*` backups before changing settings.
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.
@@ -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: leave a decision-complete plan for the current task in files before non-trivial implementation.
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. Read relevant `docs/memory/*.md`.
13
- 3. If the active or assigned model is Claude-family, read `cairn://docs/model-guidance/claude.md`; if Codex-family, read `cairn://docs/model-guidance/codex.md`, resolving it through the installed runtime.
14
- 4. Run the installed runtime's `toolcheck --root <repoRoot>`.
15
- 5. If required LSP/check tools are missing, report the proposed install and obtain explicit user approval. Only then use `toolcheck --install --yes --root <repoRoot>` for pinned/supported installers or the approved repository-native command.
16
- 6. Explore before asking the user.
17
- 7. Understand the whole work and affected surfaces first, then classify it into small executable tasks. If a task is still too broad to verify cleanly, split it into sub-tasks.
18
- 8. Run complexity triage before applying agent, plugin, or delegated workflow guidance, and record it before mutating files.
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. Use `explorer` for independent read-only discovery, impact analysis, pattern search, and read-only verification when available.
21
- 11. Treat the user-called/main agent as the orchestrator: it plans, assigns, verifies, relays received subagent status events or observable lifecycle events to the user, and records evidence. Use `worker` for actual implementation edits with clear file ownership whenever subagent tools are available, on both Light Path and Heavy Path. When the subagent tool provides a progress-reporting channel, require subagents to report status when starting work, when deciding or confirming direction, during periodic progress, and when finishing; immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
22
- 12. Write `docs/plan/<topic>.md`.
23
- 13. Add the topic link and status to `PLAN.md`.
24
- 14. Give the plan and every task stable IDs plus fail-closed task and goal evidence requirements. If implementation was requested, start or attach the Cairn goal after planning; do not activate a goal for plan-only requests.
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.
@@ -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 receipt before completing the goal.
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
- Removed items:
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 Cairn installation in the Codex cache.
16
- - Recompute hook trust state and update settings.
17
- - Overwrite Claude Code mirror files with the latest content.
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
- - Create `*.cairn-backup-*` backups before changing settings.
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.
@@ -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. For Light Path, keep the user-called/main agent in the orchestrator role and delegate implementation edits to one bounded `worker` whenever subagent tools are available, then run focused verification.
18
- 8. For Heavy Path, follow the plan's staged implementation and review gates without role-mapping shortcuts.
19
- 9. Delegate actual implementation edits to `worker` with clear file ownership on both Light Path and Heavy Path whenever subagent tools are available. When the subagent tool provides a progress-reporting channel, require subagents to report status to the orchestrator when starting work, when deciding or confirming direction, during periodic progress, and when finishing; immediately relay received status events to the user. If no mid-run reporting channel exists, relay observable events such as assignment, waiting, and final completion. Require delegated subagents to provide a final report before leaving; after capturing the final report and evidence, close or release the completed subagent, then review the final report and evidence before marking the work complete. 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. If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence.
20
- 10. For Heavy Path, run the recorded automated test command and record explicit `Tests:` evidence before any completion claim.
21
- 11. Re-run module acceptance verification.
22
- 12. Re-run surface integration verification.
23
- 13. Record successful verification as structured receipts bound to the goal/task/plan. Missing, failed, skipped, or placeholder receipts never complete a task.
24
- 14. Complete the current task, let Cairn advance to the next one, and continue until every task and goal-level final review receipt passes. Workers return only their assigned task handoff and never select the next task.
25
- 15. Record tool readiness and verification evidence in `docs/plan/<topic>.md`, update goal state, and update `PLAN.md` only after evidence exists.
26
- 16. If the user asks a side question, status question, or narrow clarification while this task is still active, answer it briefly and then resume the previous active work unless the user explicitly asks to pause, stop, or switch tasks.
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.
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. Exclude consultation, explanation, and plan-only requests. Continue through tasks until goal-level final review completes, or record an explicit pause, blocker, or cancellation.
29
- - Treat missing, failed, skipped, stale, or placeholder evidence as failure. Task receipts must be bound to the current goal, task, and plan.
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 receipt requirements"
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.1",
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
  },