cairn-ai 0.2.0 → 0.2.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cairn",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Token-efficient agent harness with tool readiness for Codex, Claude Code, and Antigravity.",
5
5
  "author": {
6
6
  "name": "WkNam"
@@ -34,7 +34,7 @@
34
34
  "If subagent tools are unavailable, the main agent takes over implementation directly and records that takeover in evidence; do not stop before local implementation solely because subagent tools are unavailable.",
35
35
  "Record Light Path or Heavy Path complexity triage in docs/plan/<topic>.md before mutating files.",
36
36
  "Run cairn-work from the current PLAN.md and pass dry-run/check, module acceptance, and surface integration gates.",
37
- "For implementation requests, persist one active Cairn goal with stable task IDs. After a task passes its required bound receipts, advance immediately to the next task and continue until goal-level final review completes; active is never a completion state.",
37
+ "For implementation or continued-execution requests, treat the request itself as authorization to persist one active Cairn goal with stable, ordered task steps, even when the user does not mention a goal. Create or attach it after the decision-complete plan and before implementation. Keep the full task roadmap and current task in hook context so a side question returns to the original work unless the user explicitly pauses, stops, or switches tasks. Do not create a goal for consultation, explanation, or plan-only requests. After a task passes its required bound receipts, advance immediately to the next task and continue until goal-level final review completes; active is never a completion state.",
38
38
  "Missing, failed, skipped, stale, or placeholder evidence never completes a task. A worker may report only its assigned task; the main agent reviews the handoff and advances the goal.",
39
39
  "If progress cannot continue, explicitly pause, block with a concrete reason, or cancel the Cairn goal instead of silently stopping. Do not repeatedly block a re-entered stop hook in the same turn.",
40
40
  "Tool installation is an external-state change: report the proposal and obtain explicit user approval before using a pinned/supported installer.",
package/README.ko.md CHANGED
@@ -111,6 +111,8 @@ cairn toolcheck
111
111
  - `cairn-work`: 현재 `PLAN.md`의 다음 모듈 작업을 실행하고 두 검증 게이트를 확보합니다.
112
112
  - `cairn-review`: 계획, memory, 증거를 기준으로 완료된 작업을 검토합니다.
113
113
 
114
+ 모든 `UserPromptSubmit`에서 Cairn은 구현 또는 계속 실행 요청 자체가 goal 생성 권한이며 사용자가 “goal”을 직접 말할 필요가 없다는 모델 가시 지침을 주입합니다. 활성 goal이 있으면 전체 순서형 task roadmap, 각 상태, 현재 task도 함께 주입하므로 에이전트가 곁가지 질문에 답한 뒤 원래 작업으로 돌아갈 수 있습니다. 에이전트는 decision-complete plan 뒤 구현 전에 goal을 생성하거나 연결하고, 상담·설명·계획 전용 요청은 goal 없이 처리합니다.
115
+
114
116
  `install`과 `upgrade`는 `~/.codex/config.toml`을 수정하기 전에 `*.cairn-backup-*` 백업을 만들고 각 표면의 runtime locator를 갱신합니다. 소스 플러그인 manifest는 validator-friendly 상태를 유지하고, 설치된 cache copy에만 Codex hook 활성화를 위한 `hooks` field가 추가됩니다. 현재 custom lifecycle은 유지하며, upgrade는 교체 대상인 cache copy가 아니라 게시/전역 package에서 실행해야 합니다.
115
117
 
116
118
  Codex는 `skills/`와 `commands/`를 사용합니다. Claude Code는 `.claude/` 아래의 mirror command와 agent definition을 사용합니다. Antigravity는 `.agents/workflows`와 global skills mirror를 사용합니다.
package/README.md CHANGED
@@ -119,6 +119,8 @@ cairn toolcheck
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.
123
+
122
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.
123
125
 
124
126
  Codex uses `skills/` and `commands/`. Claude Code uses mirrored commands and agent definitions under `.claude/`. Antigravity uses `.agents/workflows` and global skills mirrors.
@@ -25,7 +25,7 @@ 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
- - Bind active work to a persisted Cairn goal and stable task IDs. Continue through tasks until goal-level final review completes, or record an explicit pause, blocker, or cancellation.
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
29
  - Treat missing, failed, skipped, stale, or placeholder evidence as failure. Task receipts must be bound to the current goal, task, and plan.
30
30
  - Every implementation task must pass module acceptance verification and surface integration verification.
31
31
  - Before mutating external state, run the closest available dry-run, check, plan, diff, validate, or equivalent command.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cairn-ai",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Token-efficient agent harness with tool readiness for Codex, Claude Code, and Antigravity",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -203,31 +203,44 @@ function contextResult({ ko, state, event }) {
203
203
  const base = ko
204
204
  ? "Cairn 컨텍스트: 작업 전 프로젝트 루트 MEMORY.md를 읽으세요."
205
205
  : "Cairn context: read the project-root MEMORY.md before working.";
206
- if (!state || state.goal.status !== "active") return { status: 0, message: base, hookOutput: {} };
206
+ const goalPolicy = event === "user-prompt-submit"
207
+ ? (ko
208
+ ? "현재 사용자 prompt가 구현 또는 계속 실행을 요청한다면, 사용자가 goal을 언급하지 않아도 이 요청 자체를 권한으로 간주하세요. decision-complete plan에 순서가 있는 stable task 단계를 정의한 뒤 구현 전에 활성 Cairn goal을 생성하거나 연결하고, 완료·일시정지·차단·취소 상태가 될 때까지 계속 진행하세요. 상담·설명·계획 전용 요청에는 goal을 만들지 마세요."
209
+ : "If the current user prompt requests implementation or continued execution, treat the request itself as authorization even when the user does not mention a goal. Define stable, ordered task steps in a decision-complete plan, then create or attach an active Cairn goal before implementation and continue until it is completed, paused, blocked, or cancelled. Do not create a goal for consultation, explanation, or plan-only requests.")
210
+ : "";
211
+ const initialContext = [base, goalPolicy].filter(Boolean).join(" ");
212
+ if (!state || state.goal.status !== "active") return contextHookResult({ event, message: initialContext });
207
213
  const task = state.tasks.find((item) => item.status === "active") ?? state.tasks.find((item) => item.status === "pending");
208
214
  if (!task) {
209
- const message = `${base} ${activeGoalCompletionMessage(ko, state)}`;
210
- return {
211
- status: 0,
212
- message,
213
- hookOutput: {
214
- hookSpecificOutput: {
215
- hookEventName: event === "session-start" ? "SessionStart" : "UserPromptSubmit",
216
- additionalContext: message,
217
- },
218
- },
219
- };
215
+ return contextHookResult({
216
+ event,
217
+ message: [initialContext, taskRoadmap(ko, state), activeGoalCompletionMessage(ko, state)].join("\n"),
218
+ });
220
219
  }
221
220
  const continuation = ko
222
221
  ? `활성 목표 "${state.goal.title}"의 현재 task는 ${task.id} (${task.title})입니다. 완료 전 성공 receipt를 기록하세요.`
223
222
  : `Active goal "${state.goal.title}" current task: ${task.id} (${task.title}). Record a successful receipt before completing it.`;
223
+ const resume = event === "user-prompt-submit"
224
+ ? (ko
225
+ ? `곁가지 질문에 답한 뒤 사용자가 명시적으로 일시정지·중단·전환을 요청하지 않았다면 현재 task ${task.id}로 돌아와 계속 진행하세요.`
226
+ : `After answering a side question, return to current task ${task.id} and continue unless the user explicitly asks to pause, stop, or switch tasks.`)
227
+ : "";
228
+ return contextHookResult({ event, message: [initialContext, taskRoadmap(ko, state), continuation, resume].filter(Boolean).join("\n") });
229
+ }
230
+
231
+ function taskRoadmap(ko, state) {
232
+ const steps = state.tasks.map((task, index) => `${index + 1}. ${task.id} [${task.status}] ${task.title}`);
233
+ return `${ko ? "작업 단계" : "Work steps"}:\n${steps.join("\n")}`;
234
+ }
235
+
236
+ function contextHookResult({ event, message }) {
224
237
  return {
225
238
  status: 0,
226
- message: `${base} ${continuation}`,
239
+ message,
227
240
  hookOutput: {
228
241
  hookSpecificOutput: {
229
242
  hookEventName: event === "session-start" ? "SessionStart" : "UserPromptSubmit",
230
- additionalContext: `${base} ${continuation}`,
243
+ additionalContext: message,
231
244
  },
232
245
  },
233
246
  };
@@ -23,7 +23,7 @@ Resolve Cairn's read-only runtime from `references/cairn-runtime.json` next to t
23
23
 
24
24
  Use logical resource IDs such as `cairn://templates/work-plan.md` and `cairn://docs/model-guidance/codex.md` in repository plans. Resolve those IDs through `pluginRoot` only while executing. Keep `repoRoot` separate and pass it explicitly as `--root <repoRoot>`.
25
25
 
26
- For an implementation request, activate the decision-complete plan with the installed CLI:
26
+ For an implementation or continued-execution request, treat the request itself as authorization to define stable, ordered task steps and activate the decision-complete plan with the installed CLI, even when the user does not mention a goal:
27
27
 
28
28
  ```sh
29
29
  node "<pluginRoot>/scripts/cairn.mjs" goal start --root "<repoRoot>" --goal "<objective>" --plan "docs/plan/<topic>.md" --tasks '[{"id":"task-1","title":"<task>"}]' --criteria "<completion criterion>" --session "<current session_id>"
@@ -55,7 +55,7 @@ Use the current Codex hook `session_id` when it is available. If the surface doe
55
55
  - Tell every delegated agent and child subagent to read the project-root `MEMORY.md` before work, keep scope, and tell workers they are not alone in the codebase and must not revert others' edits.
56
56
  12. Create `docs/plan/<topic>.md` from `cairn://templates/work-plan.md` resolved through the installed runtime.
57
57
  13. Add a short index entry to `PLAN.md`.
58
- 14. Give every plan and task a stable ID and declare task-level and goal-level required evidence. When the user asked for implementation or continuing execution rather than a plan-only result, start or attach the repository Cairn goal after the plan is decision-complete. Do not create an active goal for consultation or planning-only requests.
58
+ 14. Give every plan and ordered task step a stable ID and declare task-level and goal-level required evidence. When the user asked for implementation or continuing execution rather than a consultation, explanation, or plan-only result, treat that request as authorization and start or attach the repository Cairn goal after the plan is decision-complete, even if the user never mentioned a goal. The task order must be sufficient for hook context to show the roadmap and restore the current task after side questions.
59
59
  15. Write user-visible responses and generated or updated documentation, plans, and memory artifacts in the OS locale unless the user asks for another language.
60
60
 
61
61
  ## Complexity Triage
@@ -19,7 +19,7 @@ When the subagent tool provides a progress-reporting channel, subagents report s
19
19
 
20
20
  Delegated subagents must provide a final report before leaving. After the orchestrator captures the final report and evidence, it must close or release the completed subagent, then review the final report and evidence before marking the work complete.
21
21
 
22
- If the user asks a side question, status question, or narrow clarification while the selected 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.
22
+ If the user asks a side question, status question, or narrow clarification while the selected task is still active, use the active goal's ordered task roadmap to preserve position, answer briefly, and then resume the current task unless the user explicitly asks to pause, stop, or switch tasks.
23
23
 
24
24
  When subagent tools are available, each agent may recursively delegate bounded sub-tasks to subagents. Every child subagent must read the project-root `MEMORY.md`, keep the assigned scope, and preserve others' edits.
25
25