@lamentis/naome 1.0.2 → 1.1.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.
Files changed (34) hide show
  1. package/Cargo.lock +2 -2
  2. package/README.md +8 -1
  3. package/bin/naome-node.js +4 -1
  4. package/bin/naome.js +198 -3
  5. package/crates/naome-cli/Cargo.toml +1 -1
  6. package/crates/naome-cli/src/main.rs +110 -13
  7. package/crates/naome-core/Cargo.toml +1 -1
  8. package/crates/naome-core/src/decision.rs +82 -11
  9. package/crates/naome-core/src/git.rs +12 -1
  10. package/crates/naome-core/src/harness_health.rs +3 -1
  11. package/crates/naome-core/src/install_plan.rs +4 -2
  12. package/crates/naome-core/src/intent.rs +914 -0
  13. package/crates/naome-core/src/journal.rs +169 -0
  14. package/crates/naome-core/src/lib.rs +10 -1
  15. package/crates/naome-core/src/models.rs +63 -4
  16. package/crates/naome-core/src/route.rs +1063 -0
  17. package/crates/naome-core/src/task_state.rs +372 -21
  18. package/crates/naome-core/tests/decision.rs +8 -6
  19. package/crates/naome-core/tests/install_plan.rs +9 -1
  20. package/crates/naome-core/tests/intent.rs +826 -0
  21. package/crates/naome-core/tests/route.rs +1159 -0
  22. package/crates/naome-core/tests/task_state.rs +203 -4
  23. package/native/darwin-arm64/naome +0 -0
  24. package/native/linux-x64/naome +0 -0
  25. package/package.json +1 -1
  26. package/templates/naome-root/.naome/bin/check-harness-health.js +7 -6
  27. package/templates/naome-root/.naome/bin/check-task-state.js +7 -6
  28. package/templates/naome-root/.naome/bin/naome.js +143 -13
  29. package/templates/naome-root/.naome/manifest.json +8 -7
  30. package/templates/naome-root/.naome/upgrade-state.json +1 -1
  31. package/templates/naome-root/AGENTS.md +30 -5
  32. package/templates/naome-root/docs/naome/agent-workflow.md +45 -24
  33. package/templates/naome-root/docs/naome/execution.md +55 -51
  34. package/templates/naome-root/docs/naome/index.md +10 -3
@@ -5,29 +5,44 @@ Use this workflow after first-run intake is complete.
5
5
  ## Before Editing
6
6
 
7
7
  1. Read `.naome/task-state.json` and `execution.md`.
8
- 2. Run `node .naome/bin/naome.js status` and use its allowed actions as the
9
- current machine-generated decision.
10
- 3. Run `node .naome/bin/check-harness-health.js`.
11
- 4. If harness health fails, do not start new feature work. Ask the user to
8
+ 2. For a natural-language user request, prefer
9
+ `node .naome/bin/naome.js route --prompt-file <path> --execute --json`.
10
+ Use its `userMessage`, `humanOptions`, `requiredContext`, and
11
+ `canCreateTask` fields instead of inventing routing or final-response text.
12
+ If route returns a `taskRoot` different from the current directory, continue
13
+ the task from that path and leave the original worktree untouched.
14
+ 3. Use `node .naome/bin/naome.js explain --prompt-file <path> --json` only when
15
+ debugging why a policy won.
16
+ 4. Run `node .naome/bin/naome.js status --json` when reporting state without
17
+ routing a new request.
18
+ 5. Run `node .naome/bin/check-harness-health.js`.
19
+ 6. If harness health fails, do not start new feature work. Ask the user to
12
20
  choose `repair_harness`, `review_harness_diff`, or
13
21
  `cancel_repair_baseline`.
14
- 5. Run `node .naome/bin/check-task-state.js --admission`.
15
- 6. If task admission fails, do not start new feature work.
16
- When the block is completed NAOME install or upgrade changes, ask the user
17
- to choose `commit_upgrade_baseline`, `review_diff_first`, or
18
- `cancel_upgrade_baseline`.
19
- When the block is a completed task diff, ask the user to choose
20
- `commit_task_baseline`, `review_task_diff`, `request_task_changes`, or
21
- `cancel_task_changes`.
22
- 7. Record the passed admission check in `.naome/task-state.json` when starting
22
+ 7. Run `node .naome/bin/check-task-state.js --admission`.
23
+ 8. If task admission fails for a natural-language work request, use
24
+ `naome route --execute --json`. Route may baseline valid completed setup or
25
+ task diffs, create an isolated task worktree around unrelated user edits,
26
+ baseline pure harness refreshes in the current worktree, and rerun
27
+ admission. Ask the user only when `humanOptions` is non-empty,
28
+ route blocks as unsafe/ambiguous, or automatic baselining fails.
29
+ 9. If route blocks or returns no mutation, do not use raw `git commit`, IDE
30
+ commit, `git add`, or hook bypass commands as a fallback. Unowned changes
31
+ are user-owned unless NAOME route explicitly isolates around them or
32
+ baselines a deterministic harness/task diff. If the user explicitly asks to
33
+ commit their own unowned changes, route must run the configured quality gate
34
+ first, require committed verification coverage for every path, and commit
35
+ only the final stabilized paths it evaluated.
36
+ 10. Record the passed admission check in `.naome/task-state.json` when starting
23
37
  the task.
24
- 8. Restate the task in concrete terms.
25
- 9. Read `.naomeignore`.
26
- 10. Exclude every path matched by `.naomeignore` from context gathering.
27
- 11. Read the task-relevant NAOME docs.
28
- 12. Inspect the existing code or docs before proposing changes.
29
- 13. Read `testing.md` and `.naome/verification.json`.
30
- 14. Identify the required proof before claiming success.
38
+ 11. Restate the task in concrete terms.
39
+ 12. Read `.naomeignore`.
40
+ 13. Exclude every path matched by `.naomeignore` from context gathering.
41
+ 14. Read only the `requiredContext` returned by route/status plus the smallest
42
+ task-relevant NAOME docs.
43
+ 15. Inspect the existing code or docs before proposing changes.
44
+ 16. Read `testing.md` and `.naome/verification.json`.
45
+ 17. Identify the required proof before claiming success.
31
46
 
32
47
  ## Instruction Boundaries
33
48
 
@@ -62,19 +77,25 @@ Use this workflow after first-run intake is complete.
62
77
  5. Do not list `.naome/task-state.json` as task scope or proof evidence.
63
78
  6. Set task state to `complete`.
64
79
  7. Run `node .naome/bin/check-task-state.js`.
65
- 8. If the task-state check prints a next-task admission notice, report it to
66
- the user with the exact listed options.
80
+ 8. If the task-state check prints a next-task admission notice, do not repeat
81
+ internal baseline options in the final response. Use the machine-generated
82
+ `userMessage` from route/status and mention `humanOptions` only when that
83
+ array is non-empty.
67
84
  9. If no rule matches or the task check fails, report the gap and ask for human
68
85
  review before claiming completion.
69
86
  10. Report changed files, exact commands, results, and remaining risk.
70
- 11. Do not say there are no open gaps while the completed task diff still needs
71
- a user baseline decision.
87
+ 11. Only ask the user for options when intent blocks, the user explicitly asks
88
+ to review/revise/cancel, or automatic baselining fails.
72
89
 
73
90
  ## Commit And Push
74
91
 
75
92
  - Prefer `naome commit -m "type(scope): summary"` for task baselines.
76
93
  - If `naome` is not on `PATH`, run
77
94
  `node .naome/bin/naome.js commit -m "type(scope): summary"`.
95
+ - Never treat a blocked NAOME route as permission to run plain `git commit`.
96
+ A commit fallback is valid only when NAOME itself executed it successfully or
97
+ when the user explicitly leaves NAOME automation and owns the manual Git
98
+ action.
78
99
  - Manual `git commit` and IDE commits are guarded by local `.git/hooks` shims,
79
100
  but agents must still reconcile Git state because hooks can be bypassed.
80
101
  - If a user already committed the diff, compare current `HEAD`, task proof, and
@@ -6,17 +6,8 @@ Use this protocol before starting or completing normal feature work.
6
6
 
7
7
  Read `.naome/task-state.json` before accepting a new user task.
8
8
 
9
- Before accepting feature work, run:
10
-
11
- ```sh
12
- node .naome/bin/check-harness-health.js
13
- ```
14
-
15
- Then run:
16
-
17
- ```sh
18
- node .naome/bin/check-task-state.js --admission
19
- ```
9
+ Before accepting feature work, run `node .naome/bin/check-harness-health.js`,
10
+ then `node .naome/bin/check-task-state.js --admission`.
20
11
 
21
12
  You may start new feature work only when harness health and admission both pass.
22
13
  If health fails, ask the user to choose `repair_harness`,
@@ -31,36 +22,53 @@ Also read `.naome/upgrade-state.json`. If upgrade status is
31
22
  `needs_agent_upgrade`, do not start feature work. Finish `upgrade.md` first.
32
23
 
33
24
  Task Control validates the real git diff. After installing or upgrading NAOME,
34
- ask the user to choose `commit_upgrade_baseline`, `review_diff_first`, or
35
- `cancel_upgrade_baseline` before starting normal feature work. Admission also
36
- fails for previous-task, setup, upgrade, or other unowned changes in the git
37
- diff.
38
-
39
- When admission fails because the git diff is dirty, use the exact options it
40
- prints:
41
-
42
- - Harness repair diff: `commit_repair_baseline`, `review_repair_diff`,
43
- `cancel_repair_baseline`.
44
- - Completed task diff: `commit_task_baseline`, `review_task_diff`,
45
- `request_task_changes`, `cancel_task_changes`.
46
- - Install or upgrade diff: `commit_upgrade_baseline`, `review_diff_first`,
47
- `cancel_upgrade_baseline`.
48
-
49
- Do not commit NAOME install or upgrade changes unless the user explicitly
50
- chooses `commit_upgrade_baseline`. If they choose it, commit only NAOME install
51
- or upgrade files.
25
+ normal feature work waits until setup is baselined. Admission also fails for
26
+ previous-task, setup, upgrade, or other unowned changes in the git diff.
27
+
28
+ Prompt intent routing is machine policy, not agent guesswork. When a user asks
29
+ for work while task/setup/unowned diff exists, run
30
+ `node .naome/bin/naome.js route --prompt-file <path> --execute --json`.
31
+ Follow `policyAction`, `userMessage`, `humanOptions`, `requiredContext`, and
32
+ `canCreateTask`. If route returns `taskRoot` different from the current
33
+ directory, continue the task from that path and leave the original worktree
34
+ untouched. Route performs valid automatic baselines, can create isolated task
35
+ worktrees around unrelated user edits, and reruns admission when policy allows,
36
+ so agents do not ask for internal baseline decisions on normal auto paths.
37
+ Pure deterministic harness refresh diffs are baselined in the current worktree
38
+ before new task creation; they do not create isolated repair-loop worktrees.
39
+
40
+ When admission fails because the git diff is dirty, run route before presenting
41
+ choices. Surface human choices only when route returns non-empty
42
+ `humanOptions`; examples are harness repair, completed task, install, upgrade,
43
+ review, revise, cancel, or manual baseline decisions.
44
+
45
+ For unowned user changes, NAOME does not offer a generic commit-or-clear action.
46
+ Route may create an isolated task worktree for a new task while leaving those
47
+ edits untouched. If the prompt asks to commit or clear unowned changes, NAOME
48
+ blocks deprecated generic options instead of mutating the repository. If the
49
+ user explicitly asks to commit their current changes, route may run the
50
+ configured user-diff quality gate. The gate uses the committed verification
51
+ profile, requires quality coverage for every changed path, reruns checks until
52
+ the diff stabilizes, rejects new or missing changed paths, and rechecks the
53
+ final diff before committing only the evaluated path set. If any required check
54
+ fails, no commit is created. Agents must not translate any blocker into plain
55
+ `git add`, raw `git commit`, IDE commit, or hook bypass commands.
56
+
57
+ When the dirty diff is a deterministic harness refresh plus unrelated user
58
+ edits, repair intent may baseline only the harness refresh. It must not stage,
59
+ clear, or commit unrelated user paths.
60
+
61
+ Do not commit NAOME install or upgrade changes unless route returns an automatic
62
+ setup baseline policy or the user explicitly chooses a manual setup baseline.
63
+ Commit only NAOME install or upgrade files.
52
64
 
53
65
  If `status` is `planning`, `implementing`, `revising`, `verifying`,
54
66
  `needs_human_review`, or `blocked`, do not start the new task. Explain the
55
67
  active blocker, list the exact human options from `blocker.humanOptions`, and
56
68
  ask the user to resolve it first.
57
69
 
58
- Allowed meta-actions while blocked:
59
-
60
- - show the blocker
61
- - approve a listed human option
62
- - request a smaller diff
63
- - cancel or mark the active task blocked
70
+ Allowed meta-actions while blocked: show the blocker, approve a listed human
71
+ option, request a smaller diff, or cancel/mark the active task blocked.
64
72
 
65
73
  ## Revisions
66
74
 
@@ -106,11 +114,8 @@ NAOME control state, not task work.
106
114
 
107
115
  ## Progress Check
108
116
 
109
- While a task is `planning`, `implementing`, `revising`, or `verifying`, use:
110
-
111
- ```sh
112
- node .naome/bin/check-task-state.js --progress
113
- ```
117
+ While a task is `planning`, `implementing`, `revising`, or `verifying`, use
118
+ `node .naome/bin/check-task-state.js --progress`.
114
119
 
115
120
  This validates the active task shape, admission record, check IDs, existing
116
121
  proof entries, and current diff scope without requiring completion proof. Use
@@ -156,17 +161,11 @@ between `activeTask.admission.gitHead` and current `HEAD`. The checker uses
156
161
  that historical task diff after the working tree is clean, so completed task
157
162
  state can stay committed without requiring the deleted file to exist.
158
163
 
159
- If the check passes but prints a next-task admission notice, include that notice
160
- in the handoff. Ask the user to choose exactly one:
161
-
162
- - `commit_task_baseline`: run `naome commit` or
163
- `node .naome/bin/naome.js commit` to commit the completed task and NAOME
164
- task-state diff.
165
- - `review_task_diff`: summarize the completed task diff and wait.
166
- - `request_task_changes`: keep the task open for follow-up changes.
167
- - `cancel_task_changes`: leave the diff unresolved and do not start new work.
168
-
169
- Do not start another feature task until one option is resolved.
164
+ If the check passes but prints a next-task admission notice, keep the final
165
+ handoff short: say the task is complete and verified, and use NAOME route/status
166
+ `userMessage` for the next step. Do not list internal baseline options unless
167
+ route returns non-empty `humanOptions`, automatic baselining fails, or the user
168
+ explicitly asks to review, revise, cancel, or commit manually.
170
169
 
171
170
  ## Git Reconciliation
172
171
 
@@ -182,6 +181,11 @@ commits or pushes outside NAOME, do not assume the harness is broken:
182
181
  The installed git hooks run commit and push gates, but hooks are guardrails, not
183
182
  the source of truth. Checks must still recover from manual Git operations.
184
183
 
184
+ Completed task history is also written to the local-only
185
+ `.naome/task-journal.jsonl` when NAOME commit/route baselines a task or when
186
+ route reconciles a clean externally committed completed task. The journal is
187
+ machine-owned working memory and should stay out of project commits.
188
+
185
189
  ## Prompt Records
186
190
 
187
191
  `request` is a compact working summary. `userPrompt.text` is the exact user
@@ -33,6 +33,8 @@ for the current step.
33
33
 
34
34
  Do not load every NAOME document by default. Start from this index, then open the
35
35
  smallest set of files needed for the task.
36
+ Do not search for generic root `ARCHITECTURE.md` or `docs/index.md` files unless
37
+ this repository's NAOME docs explicitly reference them.
36
38
 
37
39
  ## Proof Rule
38
40
 
@@ -42,9 +44,14 @@ report the exact command and result.
42
44
 
43
45
  ## Task Control Rule
44
46
 
45
- Use `naome status` or `node .naome/bin/naome.js status` to get the
46
- machine-generated next decision. Use `execution.md` and `.naome/task-state.json`
47
- before starting new work and before claiming completion. First run
47
+ Use `naome route --prompt-file <path> --execute --json` or
48
+ `node .naome/bin/naome.js route --prompt-file <path> --execute --json` for
49
+ natural-language work requests. Route returns the deterministic next decision,
50
+ human-facing `userMessage`, `humanOptions`, and `requiredContext`. Use
51
+ `naome explain --prompt-file <path> --json` only for debugging why a policy won.
52
+ Use `naome status` or `node .naome/bin/naome.js status` to report state without
53
+ routing a request. Use `execution.md` and `.naome/task-state.json` before
54
+ starting new work and before claiming completion. First run
48
55
  `node .naome/bin/check-harness-health.js`, then run
49
56
  `node .naome/bin/check-task-state.js --admission` before accepting feature work.
50
57
  If either check fails, do not accept a new feature task until the user resolves