@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,135 @@
1
+ # NAOME First-Run Protocol
2
+
3
+ Run this protocol before feature work when `.naome/init-state.json` has
4
+ `"initialized": false`.
5
+
6
+ <goal>
7
+ Turn this repository into an agent-readable codebase with minimal, accurate
8
+ context.
9
+ </goal>
10
+
11
+ <rules>
12
+ - Do not implement feature work during first-run intake.
13
+ - Read `.naomeignore` before inspecting repository files.
14
+ - Do not read, summarize, scan, import, or use paths matched by `.naomeignore`.
15
+ - Prefer repository evidence over guesses.
16
+ - Record only facts from this target repository or from the user. Do not mention
17
+ parent workspaces, outer repositories, chat/system instructions, or unrelated
18
+ agent instructions unless the files exist in this repository.
19
+ - Ignore external harness names, global skills, previous workspace instructions,
20
+ parent repository policy, and unrelated project docs unless the user
21
+ explicitly says they apply to this repository.
22
+ - Ask the user only for critical missing context.
23
+ - Mark assumptions and unknowns explicitly.
24
+ - For important claims, cite local evidence paths.
25
+ - Set `initialized` to `true` only after the required docs are filled and the
26
+ repository has enough confirmed context for future agents to work safely.
27
+ </rules>
28
+
29
+ ## Intake Steps
30
+
31
+ 1. Read `.naomeignore` and exclude every matched path from intake.
32
+ 2. Inspect existing repository instructions and docs, including README,
33
+ contributing docs, architecture docs, agent instruction files, and CI config.
34
+ 3. Detect stack, frameworks, package managers, project layout, entrypoints,
35
+ test tools, lint/typecheck/build commands, and deployment hints.
36
+ 4. Identify risky areas such as auth, billing, secrets, migrations, production
37
+ config, customer data, generated files, or fragile inherited code.
38
+ 5. Build the Proof Harness:
39
+ - inspect package files, build files, Makefiles, and CI workflows
40
+ - record real checks in `.naome/verification.json`
41
+ - mirror the human-readable map in `testing.md`
42
+ - run the fastest safe check when possible and record the result
43
+ - preserve the JSON keys and allowed values documented below
44
+ 6. Fill `repo-profile.md`, `testing.md`, `architecture.md`, and `security.md`.
45
+ 7. Ask the user for critical missing product intent, forbidden zones, or
46
+ verification commands only if repository evidence is insufficient.
47
+ 8. Update `.naome/init-state.json`:
48
+ - use `intakeStatus: "complete"` and `initialized: true` only when the
49
+ completion gate is satisfied
50
+ - use `intakeStatus: "needs_user_context"` and keep `initialized: false`
51
+ when critical product, repository, or verification context is missing
52
+ - use `intakeStatus: "partial"` and keep `initialized: false` when some docs
53
+ are filled but the repository is not ready for normal agent work
54
+
55
+ ## Completion Gate
56
+
57
+ Initialization is complete only when:
58
+
59
+ - `repo-profile.md` describes this specific repository.
60
+ - `testing.md` records at least one real verification path.
61
+ - `.naome/verification.json` contains the same durable checks and change-type
62
+ rules recorded in `testing.md`.
63
+ - `architecture.md` describes observed structure and known or assumed
64
+ boundaries.
65
+ - `security.md` records sensitive areas or states that none are known yet.
66
+ - remaining unknowns are explicit.
67
+
68
+ ## Verification Contract Schema
69
+
70
+ `.naome/verification.json` must keep this shape:
71
+
72
+ - top-level keys: `schema`, `version`, `status`, `lastUpdated`, `checks`,
73
+ `changeTypes`, `releaseGates`
74
+ - `status`: `uninitialized`, `partial`, or `ready`
75
+ - `lastUpdated` and `lastVerified`: `YYYY-MM-DD` or `null`
76
+ - check `cost`: `fast`, `medium`, `slow`, `expensive`, `ci-only`, or `unknown`
77
+ - check ids: lowercase kebab-case
78
+ - each check needs `id`, `command`, `cwd`, `purpose`, `cost`, `source`,
79
+ `evidence`, and `lastVerified`
80
+ - each change type needs `id`, `description`, `paths`, `requiredChecks`,
81
+ `recommendedChecks`, and `humanReview`
82
+ - each release gate needs `checkId` and `requiredWhen`
83
+
84
+ Rules:
85
+
86
+ - Do not add new top-level keys.
87
+ - Do not leave `example-*` ids or `replace with` values when marking ready.
88
+ - Every `requiredChecks`, `recommendedChecks`, and release `checkId` must match
89
+ an existing check id.
90
+ - Set `status` to `ready` only when the contract validates and has at least one
91
+ real check.
92
+ - This JSON is machine state, not prose context. It is exempt from the
93
+ 200-line instruction-file budget, but must stay bounded: at most 20 checks, 12
94
+ change types, and 10 release gates.
95
+ - Do not read `.naome/verification.json` as long-form context during normal
96
+ work. Select the relevant change type or check id, then read only the matching
97
+ entries needed for proof.
98
+
99
+ Do not mark initialization complete when:
100
+
101
+ - the folder is not a Git repository and it is unclear whether it is the real
102
+ project root
103
+ - the repository has no product code and no confirmed purpose
104
+ - no human-confirmed purpose, owner intent, or verification path is known
105
+ - no verification command can be found or confirmed
106
+ - open questions block safe future code changes
107
+
108
+ In those cases, fill what can be discovered, set `intakeStatus` to
109
+ `needs_user_context` or `partial`, record `blockedReason`, and ask the user for
110
+ the missing context.
111
+
112
+ ## Evidence Rule
113
+
114
+ Each required intake document should include an `Evidence` section listing the
115
+ local files or commands that support its important claims. Use relative paths
116
+ from the repository root. Do not cite files outside the target repository.
117
+ Do not cite files matched by `.naomeignore`.
118
+
119
+ Claims about repo-local agent instructions, skill directories, generated
120
+ artifacts, harness files, or automation policy require explicit evidence paths.
121
+ If the exact file or directory path is not listed in `Evidence`, phrase the item
122
+ as unknown or remove it.
123
+
124
+ ## External Instruction Conflict Check
125
+
126
+ Before completing intake:
127
+
128
+ 1. List repo-local agent instruction files in `repo-profile.md`.
129
+ 2. Treat nested `AGENTS.md` files as task-local evidence for their directory,
130
+ not as replacements for the root NAOME harness authority.
131
+ 3. Do not copy global skill policies, previous workspace policies, or parent
132
+ repo policies into NAOME docs.
133
+ 4. If a global instruction is influencing your work and conflicts with NAOME,
134
+ ask the user whether it should become local policy.
135
+ 5. Record only user-confirmed local policy in `decisions.md`.
@@ -0,0 +1,67 @@
1
+ # NAOME Index
2
+
3
+ NAOME keeps repository context small and task-routed. Load only the files needed
4
+ for the current step.
5
+
6
+ ## Read Order
7
+
8
+ 1. `.naomeignore`
9
+ 2. `.naome/init-state.json`
10
+ 3. `.naome/task-state.json`
11
+ 4. `.naome/upgrade-state.json`
12
+ 5. `node .naome/bin/check-harness-health.js`
13
+ 6. `execution.md`, before accepting or completing feature work
14
+ 7. `first-run.md`, only when `initialized` is `false`
15
+ 8. `upgrade.md`, only when upgrade `status` is `needs_agent_upgrade`
16
+ 9. `repo-profile.md`
17
+ 10. `architecture.md`
18
+ 11. `testing.md`
19
+ 12. `.naome/verification.json`
20
+ 13. `security.md`
21
+ 14. `agent-workflow.md`
22
+ 15. `decisions.md`, when changing durable project policy
23
+
24
+ ## Source Types
25
+
26
+ - Discovered facts come from repository files and commands.
27
+ - Confirmed facts were explicitly confirmed by a human or existing
28
+ authoritative documentation.
29
+ - Assumptions must be marked as assumptions and revisited when they matter.
30
+ - Unknowns should stay visible until resolved.
31
+
32
+ ## Context Rule
33
+
34
+ Do not load every NAOME document by default. Start from this index, then open the
35
+ smallest set of files needed for the task.
36
+
37
+ ## Proof Rule
38
+
39
+ Use `testing.md` and `.naome/verification.json` before claiming completion.
40
+ Choose the required check for the changed paths, run it when available, and
41
+ report the exact command and result.
42
+
43
+ ## Task Control Rule
44
+
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
48
+ `node .naome/bin/check-harness-health.js`, then run
49
+ `node .naome/bin/check-task-state.js --admission` before accepting feature work.
50
+ If either check fails, do not accept a new feature task until the user resolves
51
+ the listed action.
52
+
53
+ ## Harness Health Rule
54
+
55
+ Machine-owned harness files are listed in `.naome/manifest.json`. Agents may
56
+ repair those files with `naome sync`; project-owned files require user or
57
+ task-specific edits. Do not continue if the health checker reports missing
58
+ files, symlinks, integrity drift, or a missing `.naome/archive/` ignore rule.
59
+
60
+ ## Ignore Rule
61
+
62
+ `.naomeignore` is a hard read boundary for agents. Treat patterns as
63
+ repository-root-relative, gitignore-like paths. Blank lines and lines starting
64
+ with `#` are comments. Do not read, summarize, scan, import, or use files and
65
+ directories matched by `.naomeignore` as context or evidence. If a task appears
66
+ to require an ignored path, ask the user to remove that path from `.naomeignore`
67
+ before proceeding.
@@ -0,0 +1,51 @@
1
+ # Repository Profile
2
+
3
+ Status: Uninitialized
4
+
5
+ ## Purpose
6
+
7
+ - Unknown.
8
+
9
+ ## Stack
10
+
11
+ - Unknown.
12
+
13
+ ## Project Layout
14
+
15
+ - Unknown.
16
+
17
+ ## Package And Tooling
18
+
19
+ - Package manager: Unknown.
20
+ - Build command: Unknown.
21
+ - Test command: Unknown.
22
+ - Lint command: Unknown.
23
+ - Typecheck command: Unknown.
24
+
25
+ ## CI And Deployment
26
+
27
+ - CI: Unknown.
28
+ - Deployment: Unknown.
29
+
30
+ ## Existing Instructions
31
+
32
+ - Unknown.
33
+
34
+ ## Nested Agent Instructions
35
+
36
+ - Unknown.
37
+
38
+ ## Evidence
39
+
40
+ - Unknown.
41
+
42
+ ## Evidence Requirements
43
+
44
+ - Claims about agent instructions, skill directories, generated artifacts,
45
+ harness files, or automation policy require exact local evidence paths.
46
+
47
+ ## Open Questions
48
+
49
+ - What is the product or repository purpose?
50
+ - Which commands should agents trust for verification?
51
+ - Is this folder the real project root?
@@ -0,0 +1,60 @@
1
+ # Security And Risk
2
+
3
+ Status: Uninitialized
4
+
5
+ ## Sensitive Areas
6
+
7
+ - Unknown.
8
+
9
+ ## Secrets And Credentials
10
+
11
+ - Unknown.
12
+
13
+ ## High-Risk Changes
14
+
15
+ - Unknown.
16
+
17
+ ## Human Review Required
18
+
19
+ - Unknown.
20
+
21
+ ## Evidence
22
+
23
+ - Unknown.
24
+
25
+ ## Evidence Requirements
26
+
27
+ - Claims about credentialed automation, agent instruction files, skill
28
+ directories, generated artifacts, or harness files require exact local
29
+ evidence paths.
30
+ - Claims must not cite files matched by `.naomeignore`.
31
+
32
+ ## NAOME Ignore Boundary
33
+
34
+ `.naomeignore` defines repository paths that agents must not read. The default
35
+ entry is `.naome/archive/` so historical snapshots never become active context.
36
+
37
+ Rules:
38
+
39
+ - Read `.naomeignore` before inspecting repository files.
40
+ - Treat patterns as repository-root-relative, gitignore-like paths.
41
+ - Do not read, summarize, scan, import, or use ignored files as evidence.
42
+ - If ignored content seems necessary, ask the user to remove the path from
43
+ `.naomeignore` before continuing.
44
+
45
+ ## Harness Integrity Boundary
46
+
47
+ Machine-owned files in `.naome/manifest.json` are active harness controls.
48
+ Before feature work, run `node .naome/bin/check-harness-health.js`. Stop if it
49
+ reports missing files, symlinks, integrity drift, or a missing archive ignore
50
+ boundary. Git commits do not bless harness drift; machine-owned files must match
51
+ the packaged hashes embedded in the health checker. Repair only with the
52
+ installer or an explicit human decision.
53
+
54
+ ## Agent Rules
55
+
56
+ - Do not expose secrets.
57
+ - Do not inspect paths matched by `.naomeignore`.
58
+ - Do not modify production credentials.
59
+ - Do not weaken auth, authorization, billing, data retention, or encryption
60
+ without explicit user direction and verification.
@@ -0,0 +1,51 @@
1
+ # Testing And Verification
2
+
3
+ Status: Uninitialized
4
+
5
+ ## Verification Map
6
+
7
+ | Change type | Required proof | Command | Notes |
8
+ |---|---|---|---|
9
+ | NAOME baseline | Built-in harness proof | See Known Checks | Seeded by installer; extend during first-run intake. |
10
+ | Repository-specific work | Unknown | Unknown | Fill during first-run intake. |
11
+
12
+ ## Known Checks
13
+
14
+ | Check id | Command | Cwd | Cost | Last verified |
15
+ |---|---|---|---|---|
16
+ | diff-check | `git diff --check` | `.` | fast | null |
17
+ | naome-harness-health | `node .naome/bin/check-harness-health.js` | `.` | fast | null |
18
+ | naome-task-state | `node .naome/bin/check-task-state.js` | `.` | fast | null |
19
+
20
+ ## Change Type Rules
21
+
22
+ | Change type | Paths | Required checks |
23
+ |---|---|---|
24
+ | Unknown | Unknown | Unknown |
25
+
26
+ ## Release Gates
27
+
28
+ | Check id | Required when |
29
+ |---|---|
30
+ | Unknown | Before release, when applicable. |
31
+
32
+ ## Evidence
33
+
34
+ - `.naome/verification.json`
35
+ - `.naome/bin/check-harness-health.js`
36
+ - `.naome/bin/check-task-state.js`
37
+ - `.naome/task-contract.schema.json`
38
+
39
+ ## Rules
40
+
41
+ - Mirror durable entries in `.naome/verification.json`.
42
+ - Use only commands proven by repository files, CI, or user confirmation.
43
+ - Preserve the JSON keys from `.naome/verification.json`.
44
+ - When intake is complete, set verification `status` to `ready`.
45
+ - Use only costs: `fast`, `medium`, `slow`, `expensive`, `ci-only`, `unknown`.
46
+ - Use dates as `YYYY-MM-DD` or `null`.
47
+ - Keep instruction files under 200 lines. `.naome/verification.json` is machine
48
+ state instead; keep it schema-valid and bounded to 20 checks, 12 change types,
49
+ and 10 release gates.
50
+ - Before completion, select proof from the Verification Map when possible.
51
+ - Report exact commands and results. Do not claim proof that did not run.
@@ -0,0 +1,20 @@
1
+ # NAOME Upgrade Policy
2
+
3
+ NAOME supports controlled in-place upgrades from supported older installed
4
+ harness versions.
5
+
6
+ The supported upgrade floor is NAOME v0.6.1, the first Rust-backed harness
7
+ baseline. If `naome sync` sees `.naome/manifest.json` with a supported
8
+ `harnessVersion` lower than the package version and at or above v0.6.1, it may
9
+ refresh machine-owned harness files, install current local binaries, and update
10
+ `.naome/manifest.json` and `.naome/upgrade-state.json`.
11
+
12
+ Pre-Rust harness versions below v0.6.1 must stop without mutating repository
13
+ files. Create a clean NAOME baseline instead.
14
+
15
+ Same-version installs may be repaired with `naome sync`. Newer installed
16
+ harness versions must never be downgraded.
17
+
18
+ Agents must not start feature work while an unsupported pre-Rust harness or
19
+ pending upgrade state is present. Ask the user to create a clean baseline,
20
+ reinstall NAOME, or finish the upgrade after reviewing the local diff.