@lamentis/naome 1.0.0

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 (49) hide show
  1. package/Cargo.lock +199 -0
  2. package/Cargo.toml +11 -0
  3. package/LICENSE +21 -0
  4. package/README.md +6 -0
  5. package/bin/naome-node.js +1424 -0
  6. package/bin/naome.js +129 -0
  7. package/crates/naome-cli/Cargo.toml +14 -0
  8. package/crates/naome-cli/src/main.rs +341 -0
  9. package/crates/naome-core/Cargo.toml +11 -0
  10. package/crates/naome-core/src/decision.rs +432 -0
  11. package/crates/naome-core/src/git.rs +70 -0
  12. package/crates/naome-core/src/harness_health.rs +557 -0
  13. package/crates/naome-core/src/install_plan.rs +82 -0
  14. package/crates/naome-core/src/lib.rs +17 -0
  15. package/crates/naome-core/src/models.rs +99 -0
  16. package/crates/naome-core/src/paths.rs +72 -0
  17. package/crates/naome-core/src/task_state.rs +1859 -0
  18. package/crates/naome-core/src/verification.rs +217 -0
  19. package/crates/naome-core/src/verification_contract.rs +406 -0
  20. package/crates/naome-core/tests/decision.rs +297 -0
  21. package/crates/naome-core/tests/harness_health.rs +232 -0
  22. package/crates/naome-core/tests/install_plan.rs +35 -0
  23. package/crates/naome-core/tests/task_state.rs +588 -0
  24. package/crates/naome-core/tests/verification.rs +165 -0
  25. package/crates/naome-core/tests/verification_contract.rs +181 -0
  26. package/native/darwin-arm64/naome +0 -0
  27. package/package.json +44 -0
  28. package/templates/naome-root/.naome/bin/check-harness-health.js +163 -0
  29. package/templates/naome-root/.naome/bin/check-task-state.js +180 -0
  30. package/templates/naome-root/.naome/bin/naome.js +306 -0
  31. package/templates/naome-root/.naome/init-state.json +13 -0
  32. package/templates/naome-root/.naome/manifest.json +45 -0
  33. package/templates/naome-root/.naome/package.json +3 -0
  34. package/templates/naome-root/.naome/task-contract.schema.json +174 -0
  35. package/templates/naome-root/.naome/task-state.json +8 -0
  36. package/templates/naome-root/.naome/upgrade-state.json +7 -0
  37. package/templates/naome-root/.naome/verification.json +45 -0
  38. package/templates/naome-root/.naomeignore +4 -0
  39. package/templates/naome-root/AGENTS.md +77 -0
  40. package/templates/naome-root/docs/naome/agent-workflow.md +82 -0
  41. package/templates/naome-root/docs/naome/architecture.md +37 -0
  42. package/templates/naome-root/docs/naome/decisions.md +18 -0
  43. package/templates/naome-root/docs/naome/execution.md +192 -0
  44. package/templates/naome-root/docs/naome/first-run.md +135 -0
  45. package/templates/naome-root/docs/naome/index.md +67 -0
  46. package/templates/naome-root/docs/naome/repo-profile.md +51 -0
  47. package/templates/naome-root/docs/naome/security.md +60 -0
  48. package/templates/naome-root/docs/naome/testing.md +51 -0
  49. package/templates/naome-root/docs/naome/upgrade.md +20 -0
@@ -0,0 +1,174 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "naome.task-state.v1",
4
+ "title": "NAOME Task State",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema", "version", "status", "activeTask", "blocker", "updatedAt"],
8
+ "properties": {
9
+ "schema": { "const": "naome.task-state.v1" },
10
+ "version": { "const": 1 },
11
+ "status": {
12
+ "enum": ["idle", "planning", "implementing", "revising", "verifying", "needs_human_review", "blocked", "complete"]
13
+ },
14
+ "activeTask": {
15
+ "anyOf": [
16
+ { "type": "null" },
17
+ { "$ref": "#/$defs/activeTask" }
18
+ ]
19
+ },
20
+ "blocker": {
21
+ "anyOf": [
22
+ { "type": "null" },
23
+ { "$ref": "#/$defs/blocker" }
24
+ ]
25
+ },
26
+ "updatedAt": {
27
+ "anyOf": [
28
+ { "type": "null" },
29
+ { "type": "string", "format": "date-time" }
30
+ ]
31
+ }
32
+ },
33
+ "$defs": {
34
+ "activeTask": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["id", "request", "userPrompt", "admission", "allowedPaths", "declaredChangeTypes", "requiredCheckIds", "proofResults", "humanReview"],
38
+ "properties": {
39
+ "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
40
+ "request": { "type": "string", "minLength": 1 },
41
+ "userPrompt": { "$ref": "#/$defs/promptRecord" },
42
+ "admission": { "$ref": "#/$defs/admissionProof" },
43
+ "allowedPaths": {
44
+ "type": "array",
45
+ "minItems": 1,
46
+ "items": { "type": "string", "minLength": 1 }
47
+ },
48
+ "declaredChangeTypes": {
49
+ "type": "array",
50
+ "minItems": 1,
51
+ "items": { "type": "string", "minLength": 1 }
52
+ },
53
+ "requiredCheckIds": {
54
+ "type": "array",
55
+ "items": { "type": "string", "minLength": 1 }
56
+ },
57
+ "proofResults": {
58
+ "type": "array",
59
+ "items": { "$ref": "#/$defs/proofResult" }
60
+ },
61
+ "revisions": {
62
+ "type": "array",
63
+ "items": { "$ref": "#/$defs/revision" }
64
+ },
65
+ "humanReview": { "$ref": "#/$defs/humanReview" }
66
+ }
67
+ },
68
+ "admissionProof": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["command", "cwd", "exitCode", "checkedAt", "gitHead", "changedPaths"],
72
+ "properties": {
73
+ "command": {
74
+ "const": "node .naome/bin/check-task-state.js --admission"
75
+ },
76
+ "cwd": { "const": "." },
77
+ "exitCode": { "const": 0 },
78
+ "checkedAt": { "type": "string", "format": "date-time" },
79
+ "gitHead": { "type": "string", "minLength": 1 },
80
+ "changedPaths": {
81
+ "type": "array",
82
+ "maxItems": 0,
83
+ "items": { "type": "string", "minLength": 1 }
84
+ }
85
+ }
86
+ },
87
+ "humanReview": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["required", "approved", "reason"],
91
+ "properties": {
92
+ "required": { "type": "boolean" },
93
+ "approved": { "type": "boolean" },
94
+ "reason": {
95
+ "anyOf": [
96
+ { "type": "null" },
97
+ { "type": "string", "minLength": 1 }
98
+ ]
99
+ }
100
+ }
101
+ },
102
+ "proofResult": {
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "required": ["checkId", "command", "cwd", "exitCode", "checkedAt", "evidence"],
106
+ "properties": {
107
+ "checkId": { "type": "string", "minLength": 1 },
108
+ "command": { "type": "string", "minLength": 1 },
109
+ "cwd": { "type": "string", "minLength": 1 },
110
+ "exitCode": { "type": "integer" },
111
+ "checkedAt": { "type": "string", "format": "date-time" },
112
+ "evidence": {
113
+ "type": "array",
114
+ "items": {
115
+ "anyOf": [
116
+ { "type": "string", "minLength": 1 },
117
+ { "$ref": "#/$defs/evidenceEntry" }
118
+ ]
119
+ }
120
+ }
121
+ }
122
+ },
123
+ "evidenceEntry": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": ["path"],
127
+ "properties": {
128
+ "path": { "type": "string", "minLength": 1 },
129
+ "status": {
130
+ "enum": ["added", "modified", "deleted", "renamed"]
131
+ },
132
+ "fromPath": { "type": "string", "minLength": 1 }
133
+ }
134
+ },
135
+ "revision": {
136
+ "type": "object",
137
+ "additionalProperties": false,
138
+ "required": ["requestedAt", "request", "userPrompt"],
139
+ "properties": {
140
+ "requestedAt": { "type": "string", "format": "date-time" },
141
+ "request": { "type": "string", "minLength": 1 },
142
+ "userPrompt": { "$ref": "#/$defs/promptRecord" },
143
+ "proofStale": { "type": "boolean" }
144
+ }
145
+ },
146
+ "promptRecord": {
147
+ "type": "object",
148
+ "additionalProperties": false,
149
+ "required": ["receivedAt", "text"],
150
+ "properties": {
151
+ "receivedAt": { "type": "string", "format": "date-time" },
152
+ "text": { "type": "string", "minLength": 1 }
153
+ }
154
+ },
155
+ "blocker": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": ["type", "message", "paths", "humanOptions"],
159
+ "properties": {
160
+ "type": { "type": "string", "minLength": 1 },
161
+ "message": { "type": "string", "minLength": 1 },
162
+ "paths": {
163
+ "type": "array",
164
+ "items": { "type": "string", "minLength": 1 }
165
+ },
166
+ "humanOptions": {
167
+ "type": "array",
168
+ "minItems": 1,
169
+ "items": { "type": "string", "minLength": 1 }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "schema": "naome.task-state.v1",
3
+ "version": 1,
4
+ "status": "idle",
5
+ "activeTask": null,
6
+ "blocker": null,
7
+ "updatedAt": null
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "status": "complete",
3
+ "fromVersion": null,
4
+ "toVersion": "1.0.0",
5
+ "pending": [],
6
+ "completed": []
7
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "schema": "naome.verification.v1",
3
+ "version": 1,
4
+ "status": "uninitialized",
5
+ "lastUpdated": null,
6
+ "checks": [
7
+ {
8
+ "id": "diff-check",
9
+ "command": "git diff --check",
10
+ "cwd": ".",
11
+ "purpose": "Reject whitespace errors in the current diff.",
12
+ "cost": "fast",
13
+ "source": "NAOME built-in",
14
+ "evidence": [],
15
+ "lastVerified": null
16
+ },
17
+ {
18
+ "id": "naome-harness-health",
19
+ "command": "node .naome/bin/check-harness-health.js",
20
+ "cwd": ".",
21
+ "purpose": "Validate the installed NAOME harness before feature work or task completion.",
22
+ "cost": "fast",
23
+ "source": "NAOME built-in",
24
+ "evidence": [
25
+ ".naome/bin/check-harness-health.js"
26
+ ],
27
+ "lastVerified": null
28
+ },
29
+ {
30
+ "id": "naome-task-state",
31
+ "command": "node .naome/bin/check-task-state.js",
32
+ "cwd": ".",
33
+ "purpose": "Validate the NAOME task-state contract for the current repository.",
34
+ "cost": "fast",
35
+ "source": "NAOME built-in",
36
+ "evidence": [
37
+ ".naome/bin/check-task-state.js",
38
+ ".naome/task-contract.schema.json"
39
+ ],
40
+ "lastVerified": null
41
+ }
42
+ ],
43
+ "changeTypes": [],
44
+ "releaseGates": []
45
+ }
@@ -0,0 +1,4 @@
1
+ # NAOME ignore paths.
2
+ # Agents must not read, summarize, scan, import, or use these paths as context.
3
+
4
+ .naome/archive/
@@ -0,0 +1,77 @@
1
+ # Agent Instructions
2
+
3
+ This repository uses NAOME as its coding-agent harness.
4
+
5
+ ## Start Here
6
+
7
+ 1. Read `.naomeignore`.
8
+ 2. Do not read any file or directory matched by `.naomeignore`.
9
+ 3. If `docs/naome/index.md` or `.naome/bin/check-harness-health.js` is missing,
10
+ do not begin feature work. Install the NAOME CLI with
11
+ `npm install -g @lamentis/naome`, then run `naome sync` from the repository root. Then
12
+ restart this list.
13
+ 4. Read `docs/naome/index.md`.
14
+ 5. Read `.naome/init-state.json`.
15
+ 6. Read `.naome/task-state.json`.
16
+ 7. Read `.naome/upgrade-state.json`.
17
+ 8. Run `node .naome/bin/check-harness-health.js`.
18
+ 9. If harness health fails, do not begin feature work. Repair the machine-owned
19
+ harness files with `naome sync`, or ask the user for one of the listed
20
+ repair decisions.
21
+ 10. If upgrade status is `needs_agent_upgrade`, do not begin feature work. Run
22
+ or continue `docs/naome/upgrade.md`.
23
+ 11. If `initialized` is `false`, do not begin feature work. Run or continue the
24
+ NAOME first-run protocol in `docs/naome/first-run.md`.
25
+ 12. Before accepting feature work, run
26
+ `node .naome/bin/check-task-state.js --admission`.
27
+ 13. If task admission fails, follow `docs/naome/execution.md`.
28
+ 14. If `initialized` is `true`, follow `docs/naome/agent-workflow.md`.
29
+
30
+ ## Core Rules
31
+
32
+ - Prefer discovered repository facts over assumptions.
33
+ - Record only facts from this target repository or from the user. Do not import
34
+ parent-workspace, outer-agent, chat, or unrelated repository instructions into
35
+ this repository's NAOME docs.
36
+ - Keep changes small and task-focused.
37
+ - Read only the NAOME docs relevant to the current task.
38
+ - Run Harness Health before Task Admission.
39
+ - Machine-owned NAOME command shims, schemas, workflow docs, archives, and
40
+ native binaries may be local-only ignored files. Missing local-only files are
41
+ repaired with `naome sync`; they are not project context.
42
+ - Enforce Task Admission before accepting new feature work.
43
+ - Do not start feature work while the git diff contains setup, upgrade,
44
+ previous-task, or other unowned changes.
45
+ - Treat `.naomeignore` as a hard read boundary. Do not inspect ignored paths
46
+ unless the user first removes the path from `.naomeignore`.
47
+ - Use `docs/naome/testing.md` and `.naome/verification.json` before claiming
48
+ completion.
49
+ - Before claiming completion, run the narrowest meaningful verification that can
50
+ falsify the change.
51
+ - Report what changed, what was verified, and what remains uncertain.
52
+
53
+ ## Local Authority Boundary
54
+
55
+ The root `AGENTS.md` and NAOME files are the repository harness authority.
56
+
57
+ Global skills, editor rules, or agent defaults may be used only as generic
58
+ execution technique. They must not add repository policy, required files,
59
+ architecture layers, plan formats, verification rules, or product assumptions
60
+ unless those rules exist in this repository or the user explicitly confirms them
61
+ for this repository.
62
+
63
+ If global instructions conflict with NAOME, follow NAOME for repository-local
64
+ workflow. Record a conflict in `docs/naome/decisions.md` only when the user makes
65
+ a durable local decision.
66
+
67
+ ## Nested Agent Instructions
68
+
69
+ Nested `AGENTS.md` files may provide task-local evidence for the directory they
70
+ govern. They must not override `.naomeignore`, NAOME workflow, security rules,
71
+ or the root harness authority.
72
+
73
+ ## Archived Instructions
74
+
75
+ Files matched by `.naomeignore` are not active instructions. Historical
76
+ snapshots in `.naome/archive/` must not be read or used as context unless the
77
+ user first removes that path from `.naomeignore`.
@@ -0,0 +1,82 @@
1
+ # NAOME Agent Workflow
2
+
3
+ Use this workflow after first-run intake is complete.
4
+
5
+ ## Before Editing
6
+
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
12
+ choose `repair_harness`, `review_harness_diff`, or
13
+ `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
23
+ 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.
31
+
32
+ ## Instruction Boundaries
33
+
34
+ - Use global skills or editor defaults only as generic technique.
35
+ - Do not import external harness policy into this repository.
36
+ - NAOME controls what becomes repository policy unless the user explicitly says
37
+ otherwise.
38
+ - `.naomeignore` controls paths that are not valid agent context.
39
+ - Nested `AGENTS.md` files may be used only as task-local evidence for their
40
+ directory. They cannot override `.naomeignore`, NAOME workflow, security
41
+ rules, or the root harness authority.
42
+ - If instructions conflict, pause before making risky changes and ask which
43
+ rule should be local authority.
44
+
45
+ ## While Editing
46
+
47
+ - Keep changes focused on the requested outcome.
48
+ - Follow the architecture boundaries recorded in `architecture.md`.
49
+ - Do not read or use files matched by `.naomeignore`.
50
+ - Do not overwrite user work or existing project policy.
51
+ - Update NAOME docs only when the change reveals durable project knowledge.
52
+ - Use `node .naome/bin/check-task-state.js --progress` for in-flight task
53
+ validation. Use the normal task-state check only after setting `complete`.
54
+
55
+ ## Before Completion
56
+
57
+ 1. Identify changed files.
58
+ 2. Match them against `.naome/verification.json`.
59
+ 3. Run the required checks when available.
60
+ 4. Record proof in `.naome/task-state.json`, including every changed in-scope
61
+ path reported by git in proof evidence.
62
+ 5. Do not list `.naome/task-state.json` as task scope or proof evidence.
63
+ 6. Set task state to `complete`.
64
+ 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.
67
+ 9. If no rule matches or the task check fails, report the gap and ask for human
68
+ review before claiming completion.
69
+ 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.
72
+
73
+ ## Commit And Push
74
+
75
+ - Prefer `naome commit -m "type(scope): summary"` for task baselines.
76
+ - If `naome` is not on `PATH`, run
77
+ `node .naome/bin/naome.js commit -m "type(scope): summary"`.
78
+ - Manual `git commit` and IDE commits are guarded by local `.git/hooks` shims,
79
+ but agents must still reconcile Git state because hooks can be bypassed.
80
+ - If a user already committed the diff, compare current `HEAD`, task proof, and
81
+ remaining working-tree changes before deciding whether to mark the task
82
+ complete, revise it, or start a new task.
@@ -0,0 +1,37 @@
1
+ # Architecture
2
+
3
+ Status: Uninitialized
4
+
5
+ ## Observed Structure
6
+
7
+ - Unknown.
8
+
9
+ ## Known Boundaries
10
+
11
+ - Unknown.
12
+
13
+ ## Assumed Boundaries
14
+
15
+ - Unknown.
16
+
17
+ ## Dependency Rules
18
+
19
+ - Unknown.
20
+
21
+ ## Generated Or External Code
22
+
23
+ - Unknown.
24
+
25
+ ## Evidence
26
+
27
+ - Unknown.
28
+
29
+ ## Evidence Requirements
30
+
31
+ - Claims about generated artifacts, harness files, skill directories, or
32
+ automation policy require exact local evidence paths.
33
+
34
+ ## Open Architecture Questions
35
+
36
+ - Which modules or directories are authoritative boundaries?
37
+ - Which shortcuts should agents avoid?
@@ -0,0 +1,18 @@
1
+ # Decisions
2
+
3
+ Record durable project decisions that future agents should preserve.
4
+
5
+ Only record decisions that apply to this target repository. Do not copy global
6
+ skills, previous workspace rules, or unrelated harness policy into this file
7
+ unless the user explicitly confirms that they should become local policy.
8
+
9
+ ## Template
10
+
11
+ ```md
12
+ ## YYYY-MM-DD: Decision title
13
+
14
+ - Decision:
15
+ - Reason:
16
+ - Applies to:
17
+ - Verification or follow-up:
18
+ ```
@@ -0,0 +1,192 @@
1
+ # NAOME Task Execution
2
+
3
+ Use this protocol before starting or completing normal feature work.
4
+
5
+ ## Task Admission
6
+
7
+ Read `.naome/task-state.json` before accepting a new user task.
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
+ ```
20
+
21
+ You may start new feature work only when harness health and admission both pass.
22
+ If health fails, ask the user to choose `repair_harness`,
23
+ `review_harness_diff`, or `cancel_repair_baseline`.
24
+
25
+ Harness health is a deterministic lifecycle gate, not an agent judgment call.
26
+ When machine-owned harness files are unhealthy, normal task admission,
27
+ progress, completion, commit, and push gates are blocked. Only status, health,
28
+ review, and repair-baseline flows may continue until health is restored.
29
+
30
+ Also read `.naome/upgrade-state.json`. If upgrade status is
31
+ `needs_agent_upgrade`, do not start feature work. Finish `upgrade.md` first.
32
+
33
+ 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.
52
+
53
+ If `status` is `planning`, `implementing`, `revising`, `verifying`,
54
+ `needs_human_review`, or `blocked`, do not start the new task. Explain the
55
+ active blocker, list the exact human options from `blocker.humanOptions`, and
56
+ ask the user to resolve it first.
57
+
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
64
+
65
+ ## Revisions
66
+
67
+ Use one task for follow-up corrections that belong to the same unbaselined
68
+ work. If the user chooses `request_task_changes` or asks for a small correction
69
+ while the completed task diff is still open:
70
+
71
+ - set `status` to `revising`
72
+ - keep the same `activeTask.id`
73
+ - append an `activeTask.revisions[]` entry with `requestedAt`, summarized
74
+ `request`, exact `userPrompt`, and `proofStale: true`
75
+ - clear or rerun proof before returning to `complete`
76
+
77
+ If the request expands scope beyond `allowedPaths`, move to
78
+ `needs_human_review` and ask whether to approve the scope change or start a new
79
+ task.
80
+
81
+ ## Start A Task
82
+
83
+ When starting work, update `.naome/task-state.json`:
84
+
85
+ - set `status` to `planning`
86
+ - set `activeTask.id` to a short kebab-case id
87
+ - summarize the user request in `activeTask.request`
88
+ - copy the exact task-starting user prompt into `activeTask.userPrompt.text`
89
+ with `activeTask.userPrompt.receivedAt`
90
+ - record the passed admission check in `activeTask.admission`, including the
91
+ exact command, exit code, current git HEAD, and empty changed path list
92
+ - set `allowedPaths` to the narrowest expected path list
93
+ - set `declaredChangeTypes` from `.naome/verification.json`
94
+ - set `requiredCheckIds` from the matching change types
95
+ - set `proofResults` to an empty array
96
+ - set `humanReview.required` when matching rules require review
97
+
98
+ Use exact changed paths, not guessed shortcuts. If the user asks for `README.md`
99
+ but the repository only has `packages/next/README.md`, use the real path or ask
100
+ before editing. If a requested path is a symlink, use the path reported by git
101
+ diff for `allowedPaths` and proof evidence.
102
+
103
+ Then set `status` to `implementing` only after scope and proof are known.
104
+ Do not include `.naome/task-state.json` in task scope or proof evidence; it is
105
+ NAOME control state, not task work.
106
+
107
+ ## Progress Check
108
+
109
+ While a task is `planning`, `implementing`, `revising`, or `verifying`, use:
110
+
111
+ ```sh
112
+ node .naome/bin/check-task-state.js --progress
113
+ ```
114
+
115
+ This validates the active task shape, admission record, check IDs, existing
116
+ proof entries, and current diff scope without requiring completion proof. Use
117
+ the normal task-state check only when moving the task to `complete`.
118
+
119
+ ## Human Review
120
+
121
+ Set `status` to `needs_human_review` when:
122
+
123
+ - changed files are outside `allowedPaths`
124
+ - required proof is missing or failed
125
+ - human review is required but not approved
126
+ - change type is unknown
127
+ - instructions conflict
128
+ - a risky path or security boundary is touched
129
+
130
+ Write a short `blocker.message`, affected `blocker.paths`, and concrete
131
+ `blocker.humanOptions`. Run `node .naome/bin/check-task-state.js` after setting
132
+ human review. If it reports missing blocker paths or invalid proof evidence,
133
+ fix the task state before asking the human to choose an option.
134
+
135
+ ## Completion
136
+
137
+ Before claiming completion:
138
+
139
+ 1. Record every required proof in `activeTask.proofResults`.
140
+ 2. Ensure proof evidence includes every changed in-scope path.
141
+ 3. Ensure `.naome/task-state.json` is not listed in `allowedPaths` or evidence.
142
+ 4. Set `status` to `complete`.
143
+ 5. Run `node .naome/bin/check-task-state.js` from the repository root.
144
+ 6. If the check fails, move back to `needs_human_review`, `verifying`, or
145
+ `implementing` as appropriate.
146
+
147
+ Completion is valid only when the task-state check passes.
148
+
149
+ Do not reset `.naome/task-state.json` to idle just to hide the completed task.
150
+ The completed task state is part of the task baseline and should be committed
151
+ with the task diff. The next admitted task may overwrite it after the working
152
+ tree is clean.
153
+
154
+ Deleted-file proof remains valid after baseline when the file was deleted
155
+ between `activeTask.admission.gitHead` and current `HEAD`. The checker uses
156
+ that historical task diff after the working tree is clean, so completed task
157
+ state can stay committed without requiring the deleted file to exist.
158
+
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.
170
+
171
+ ## Git Reconciliation
172
+
173
+ Git is the durable baseline. NAOME task state is working memory. If a user
174
+ commits or pushes outside NAOME, do not assume the harness is broken:
175
+
176
+ - if `HEAD` changed after admission and the task is now clean and complete,
177
+ treat the task as externally baselined after proof review
178
+ - if `HEAD` changed while a task is still active, reconcile before continuing
179
+ - prefer a follow-up revision commit over rewriting user commits unless the
180
+ user explicitly asks to amend or rewrite history
181
+
182
+ The installed git hooks run commit and push gates, but hooks are guardrails, not
183
+ the source of truth. Checks must still recover from manual Git operations.
184
+
185
+ ## Prompt Records
186
+
187
+ `request` is a compact working summary. `userPrompt.text` is the exact user
188
+ input that started the task or revision, so task intent survives context
189
+ compaction and agent handoff. Store only user-provided task input. Do not store
190
+ system prompts, developer prompts, outer-agent instructions, or unrelated chat
191
+ history. If the user prompt contains secrets, pause for human review before
192
+ committing task state.