@njeybe/nativ 2.4.1 → 2.5.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 (139) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +26 -0
  3. package/dist/commands/db/db-formatter.d.ts +5 -0
  4. package/dist/commands/db/db-formatter.js +116 -0
  5. package/dist/commands/db/db-introspect.d.ts +11 -0
  6. package/dist/commands/db/db-introspect.js +84 -0
  7. package/dist/commands/db.js +4 -206
  8. package/dist/commands/profile.d.ts +3 -0
  9. package/dist/commands/profile.js +39 -0
  10. package/dist/commands/task/task-add.d.ts +11 -0
  11. package/dist/commands/task/task-add.js +169 -0
  12. package/dist/commands/task/task-common.d.ts +57 -0
  13. package/dist/commands/task/task-common.js +45 -0
  14. package/dist/commands/task/task-escalate.d.ts +7 -0
  15. package/dist/commands/task/task-escalate.js +119 -0
  16. package/dist/commands/task/task-lifecycle.d.ts +5 -0
  17. package/dist/commands/task/task-lifecycle.js +252 -0
  18. package/dist/commands/task/task-query.d.ts +10 -0
  19. package/dist/commands/task/task-query.js +269 -0
  20. package/dist/commands/task.d.ts +9 -87
  21. package/dist/commands/task.js +8 -850
  22. package/dist/commands/triage/triage-store.d.ts +56 -0
  23. package/dist/commands/triage/triage-store.js +108 -0
  24. package/dist/commands/triage/triage-ui.d.ts +14 -0
  25. package/dist/commands/triage/triage-ui.js +104 -0
  26. package/dist/commands/triage.d.ts +3 -52
  27. package/dist/commands/triage.js +8 -216
  28. package/dist/core/enforcement.d.ts +1 -0
  29. package/dist/core/enforcement.js +19 -0
  30. package/dist/core/human-gate.d.ts +2 -1
  31. package/dist/core/human-gate.js +9 -2
  32. package/dist/core/profiles.d.ts +14 -0
  33. package/dist/core/profiles.js +82 -0
  34. package/dist/core/setup/config-merger.d.ts +59 -0
  35. package/dist/core/setup/config-merger.js +107 -0
  36. package/dist/core/setup/session-context.d.ts +4 -0
  37. package/dist/core/setup/session-context.js +65 -0
  38. package/dist/core/setup/setup-planner.d.ts +14 -0
  39. package/dist/core/setup/setup-planner.js +180 -0
  40. package/dist/core/setup/template-planner.d.ts +8 -0
  41. package/dist/core/setup/template-planner.js +32 -0
  42. package/dist/core/setup/types.d.ts +65 -0
  43. package/dist/core/setup/types.js +55 -0
  44. package/dist/core/setup-assets.d.ts +8 -119
  45. package/dist/core/setup-assets.js +7 -437
  46. package/dist/core/tier1-liaison.d.ts +2 -0
  47. package/dist/core/tier1-liaison.js +64 -3
  48. package/dist/core/verifier/executor.d.ts +5 -0
  49. package/dist/core/verifier/executor.js +62 -0
  50. package/dist/core/verifier/phases.d.ts +5 -0
  51. package/dist/core/verifier/phases.js +71 -0
  52. package/dist/core/verifier/task-verifier.d.ts +37 -0
  53. package/dist/core/verifier/task-verifier.js +233 -0
  54. package/dist/core/verifier/types.d.ts +51 -0
  55. package/dist/core/verifier/types.js +1 -0
  56. package/dist/core/verifier.d.ts +5 -93
  57. package/dist/core/verifier.js +5 -359
  58. package/dist/db/introspector.js +59 -59
  59. package/dist/governor/evaluator.d.ts +4 -64
  60. package/dist/governor/evaluator.js +21 -686
  61. package/dist/governor/patch-applier.d.ts +8 -0
  62. package/dist/governor/patch-applier.js +121 -0
  63. package/dist/governor/self-healing.d.ts +24 -0
  64. package/dist/governor/self-healing.js +351 -0
  65. package/dist/governor/test-integrity.d.ts +41 -0
  66. package/dist/governor/test-integrity.js +237 -0
  67. package/dist/index.js +8 -0
  68. package/dist/mcp/capture.d.ts +4 -0
  69. package/dist/mcp/capture.js +33 -0
  70. package/dist/mcp/resources.d.ts +39 -0
  71. package/dist/mcp/resources.js +44 -0
  72. package/dist/mcp/server.d.ts +11 -0
  73. package/dist/mcp/server.js +14 -89
  74. package/dist/mcp/tools.d.ts +1 -0
  75. package/dist/mcp/tools.js +1 -0
  76. package/dist/runner/agent-supervisor.d.ts +8 -302
  77. package/dist/runner/agent-supervisor.js +41 -1030
  78. package/dist/runner/cli-config.d.ts +84 -0
  79. package/dist/runner/cli-config.js +215 -0
  80. package/dist/runner/native-driver.d.ts +18 -0
  81. package/dist/runner/native-driver.js +208 -0
  82. package/dist/runner/native-engine.d.ts +27 -0
  83. package/dist/runner/native-engine.js +184 -0
  84. package/dist/runner/native-tools.d.ts +31 -0
  85. package/dist/runner/native-tools.js +241 -0
  86. package/dist/runner/process-utils.d.ts +12 -0
  87. package/dist/runner/process-utils.js +96 -0
  88. package/dist/runner/run-lifecycle.d.ts +6 -0
  89. package/dist/runner/run-lifecycle.js +42 -0
  90. package/dist/runner/types.d.ts +215 -0
  91. package/dist/runner/types.js +41 -0
  92. package/dist/scanner/detector.js +42 -663
  93. package/dist/scanner/detectors/ecosystem-detector.d.ts +16 -0
  94. package/dist/scanner/detectors/ecosystem-detector.js +354 -0
  95. package/dist/scanner/detectors/orm-detector.d.ts +5 -0
  96. package/dist/scanner/detectors/orm-detector.js +59 -0
  97. package/dist/scanner/detectors/workspace-detector.d.ts +19 -0
  98. package/dist/scanner/detectors/workspace-detector.js +266 -0
  99. package/dist/server/cli-runner.d.ts +15 -0
  100. package/dist/server/cli-runner.js +43 -0
  101. package/dist/server/event-hub.d.ts +42 -0
  102. package/dist/server/event-hub.js +169 -0
  103. package/dist/server/http-utils.d.ts +15 -0
  104. package/dist/server/http-utils.js +56 -0
  105. package/dist/server/plan-utils.d.ts +9 -0
  106. package/dist/server/plan-utils.js +31 -0
  107. package/dist/server/routes/db-routes.d.ts +57 -0
  108. package/dist/server/routes/db-routes.js +484 -0
  109. package/dist/server/routes/task-routes.d.ts +266 -0
  110. package/dist/server/routes/task-routes.js +285 -0
  111. package/dist/server/routes/telemetry-routes.d.ts +128 -0
  112. package/dist/server/routes/telemetry-routes.js +179 -0
  113. package/dist/server/routes/triage-routes.d.ts +81 -0
  114. package/dist/server/routes/triage-routes.js +244 -0
  115. package/dist/server/routes/worktree-routes.d.ts +31 -0
  116. package/dist/server/routes/worktree-routes.js +144 -0
  117. package/dist/server/studio-server.d.ts +4 -11
  118. package/dist/server/studio-server.js +34 -1578
  119. package/dist/server/studio-ui/shell/pipeline-state.js +2 -0
  120. package/dist/server/studio-ui/shell/triage.js +10 -0
  121. package/package.json +2 -2
  122. package/plugin/.claude-plugin/plugin.json +1 -1
  123. package/plugin/agents/architect.md +4 -2
  124. package/plugin/agents/verifier.md +1 -1
  125. package/plugin/agents/worker.md +7 -4
  126. package/plugin/skills/nativ/SKILL.md +1 -0
  127. package/templates/.claudeignore +62 -45
  128. package/templates/AGENTS.md +1 -0
  129. package/templates/CLAUDE.md +13 -0
  130. package/templates/claude-agents/architect.md +4 -2
  131. package/templates/claude-agents/verifier.md +1 -1
  132. package/templates/claude-agents/worker.md +7 -4
  133. package/templates/dot-ai/api_contracts.json +66 -66
  134. package/templates/dot-ai/context.md +38 -38
  135. package/templates/dot-ai/db_schema.json +39 -39
  136. package/dist/commands/session.d.ts +0 -22
  137. package/dist/commands/session.js +0 -106
  138. package/dist/core/session-memory.d.ts +0 -42
  139. package/dist/core/session-memory.js +0 -121
@@ -83,9 +83,11 @@ export const pipelineStateScript = String.raw ` // ─── Pipeline state ─
83
83
  pipe.escalations = Array.isArray(body.escalations) ? body.escalations : [];
84
84
  syncHealTab();
85
85
  renderTriageChip();
86
+ if (typeof checkAutoTriage === 'function') checkAutoTriage();
86
87
  } else if (part === 'triage') {
87
88
  pipe.triage = body;
88
89
  renderTriageChip();
90
+ if (typeof checkAutoTriage === 'function') checkAutoTriage();
89
91
  }
90
92
  }
91
93
 
@@ -59,6 +59,15 @@ export const triageScript = String.raw ` // ─── Tier 1 AI Strategist (/ap
59
59
  ($('t1-auto').disabled ? menu : $('t1-auto')).focus();
60
60
  }
61
61
 
62
+ function checkAutoTriage() {
63
+ if (!pipe.triage || !pipe.triage.autoTriageEnabled) return;
64
+ (pipe.escalations || []).forEach(function (e) {
65
+ if (e && e.status === 'pending_review' && !e.triage && !pipe.triageRunning[e.id]) {
66
+ runTriage(e);
67
+ }
68
+ });
69
+ }
70
+
62
71
  function setAutoTriage(enabled) {
63
72
  if (pipe.busy.triageConfig) return;
64
73
  pipe.busy.triageConfig = true;
@@ -66,6 +75,7 @@ export const triageScript = String.raw ` // ─── Tier 1 AI Strategist (/ap
66
75
  postJson('/api/pipeline/triage/config', { autoTriageEnabled: enabled }).then(function (body) {
67
76
  pipe.triage = Object.assign({}, pipe.triage || {}, { autoTriageEnabled: !!(body.config && body.config.autoTriageEnabled) });
68
77
  toast(enabled ? 'Autonomous Auto-Triage on: fixes Tier 1 proves safe are applied without asking' : 'Autonomous Auto-Triage off: every fix waits for your approval', 'ok');
78
+ if (enabled) checkAutoTriage();
69
79
  }, function (e) {
70
80
  toast('Could not change Autonomous Auto-Triage: ' + e.message);
71
81
  }).then(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@njeybe/nativ",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "Role-based multi-agent workflow harness: Claude Code by default, other AI agents pluggable",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "prepare": "npm run build",
23
23
  "prepublishOnly": "npm run build && node scripts/sync-plugin.mjs --check",
24
24
  "start": "node bin/cli.js",
25
- "test": "node tests/test-task-router.mjs && node tests/test-task-fields.mjs && node tests/test-design-templates.mjs && node tests/test-spec-slices.mjs && node tests/test-learnings.mjs && node tests/test-contract-generator.mjs && node tests/test-verify-gatekeeper.mjs && node tests/test-mcp-server.mjs && node tests/test-data-studio.mjs && node tests/test-fragmented-env.mjs && node tests/test-env-example-detection.mjs && node tests/test-contract-governor.mjs && node tests/test-worktree-lifecycle.mjs && node tests/test-agent-supervisor.mjs && node tests/test-concurrency-locks.mjs && node tests/test-telemetry-engine.mjs && node tests/test-benchmark-suite.mjs && node tests/test-providers.mjs && node tests/test-tier1-liaison.mjs && node tests/test-enforcement.mjs && node tests/test-setup-doctor.mjs && node tests/test-update.mjs && node tests/test-validate.mjs && node tests/test-plugin-manifest.mjs && node tests/test-code-shape.mjs && node tests/test-model-routing.mjs && node tests/test-v2-e2e.mjs && npx tsx tests/test-studio-pipeline-api.mjs && npx tsx tests/test-studio-light-ui.mjs && npx tsx tests/test-studio-shell.mjs && npx tsx tests/test-studio-home.mjs && npx tsx tests/test-studio-tasks-view.mjs && npx tsx tests/test-studio-flow.mjs && npx tsx tests/test-studio-team.mjs && npx tsx tests/test-studio-redesign-e2e.mjs"
25
+ "test": "node tests/test-profiles.mjs && node tests/test-task-router.mjs && node tests/test-task-fields.mjs && node tests/test-design-templates.mjs && node tests/test-spec-slices.mjs && node tests/test-learnings.mjs && node tests/test-contract-generator.mjs && node tests/test-verify-gatekeeper.mjs && node tests/test-mcp-server.mjs && node tests/test-data-studio.mjs && node tests/test-fragmented-env.mjs && node tests/test-env-example-detection.mjs && node tests/test-contract-governor.mjs && node tests/test-worktree-lifecycle.mjs && node tests/test-agent-supervisor.mjs && node tests/test-concurrency-locks.mjs && node tests/test-telemetry-engine.mjs && node tests/test-benchmark-suite.mjs && node tests/test-providers.mjs && node tests/test-tier1-liaison.mjs && node tests/test-enforcement.mjs && node tests/test-setup-doctor.mjs && node tests/test-update.mjs && node tests/test-validate.mjs && node tests/test-plugin-manifest.mjs && node tests/test-code-shape.mjs && node tests/test-model-routing.mjs && node tests/test-v2-e2e.mjs && npx tsx tests/test-studio-pipeline-api.mjs && npx tsx tests/test-studio-light-ui.mjs && npx tsx tests/test-studio-shell.mjs && npx tsx tests/test-studio-home.mjs && npx tsx tests/test-studio-tasks-view.mjs && npx tsx tests/test-studio-flow.mjs && npx tsx tests/test-studio-team.mjs && npx tsx tests/test-studio-redesign-e2e.mjs"
26
26
  },
27
27
  "keywords": [
28
28
  "ai",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nativ",
3
3
  "displayName": "nativ",
4
- "version": "2.4.1",
4
+ "version": "2.5.0",
5
5
  "description": "Role-based multi-agent workflow for Claude Code: architect, worker, verifier and explorer agents, task-scope enforcement, and the nativ MCP server.",
6
6
  "author": {
7
7
  "name": "JB Natividad"
@@ -45,9 +45,11 @@ Token limits: exactly two directions, style tiles only in Full, compact wirefram
45
45
  ## Task breakdown
46
46
 
47
47
  - About one component or endpoint per task, at most 5 files.
48
- - `acceptanceCriteria` in plain words, including which states apply (loading, empty, error).
48
+ - Reusable components first: If a UI element or primitive is needed across multiple views, create a dedicated foundational component task first and register it under the Shared Component Registry in `.ai/ui_specs.md` before dependent screen tasks.
49
+ - `acceptanceCriteria` in plain words, including which states apply (loading, empty, error) and which shared components must be reused.
49
50
  - `specRefs` point to exact sections, such as `ui_specs.md#appointment-list` or an `api_contracts.json` route.
50
51
  - `complexity` is `simple`, `standard` or `complex`.
52
+ - `verificationCommand` must be a targeted single-file test (e.g. `npx vitest run path/to/file.test.ts`), taking < 5s. Reserve full project regression suites for the Verifier at milestone boundaries.
51
53
  - Dependencies make parallel-safe work explicit: tasks that touch different files and need no result from each other have none between them.
52
54
 
53
55
  ```bash
@@ -55,7 +57,7 @@ nativ task add "Appointment list" --agent frontend \
55
57
  --spec-refs "ui_specs.md#appointment-list,api_contracts.json#GET /appointments" \
56
58
  --complexity standard \
57
59
  --accept "Shows name and time per row" --accept "Empty and error states shown" \
58
- --files src/components/AppointmentList.tsx --deps task-3 --verify "npm test"
60
+ --files src/components/AppointmentList.tsx --deps task-3 --verify "npx vitest run tests/unit/AppointmentList.test.tsx"
59
61
  ```
60
62
 
61
63
  ## Limits
@@ -18,7 +18,7 @@ You did not write this code, and that is the point: check it as a skeptic would.
18
18
  - table, column, route and schema names match `.ai/db_schema.json` and `.ai/api_contracts.json`
19
19
  - only the task's `targetFiles` changed, and no tests were deleted or weakened
20
20
  - no secrets, connection strings or data in code, logs, tests or commits
21
- - the `## Code style` rules in `AGENTS.md` are followed (lines over 120 characters, comments over 2 lines, oversized files or UI files with several components); report violations as findings
21
+ - the `## Code style` rules in `AGENTS.md` are followed (lines over 120 characters, comments over 2 lines, oversized files, UI files with several components, or duplicating existing shared UI components with inline custom markup); report violations as findings
22
22
  - errors are handled and inputs are validated at the boundary
23
23
  4. Report in short findings, most serious first. For each: the file and line, what is wrong, and why it matters. Separate confirmed problems from suspicions and say which is which.
24
24
  5. If you find nothing, say what you checked so the result can be trusted.
@@ -3,8 +3,8 @@ name: worker
3
3
  description: Implements exactly one nativ task inside its targetFiles and verifies it. Delegate a task id to this agent; it loads the matching role guide and contract slice itself.
4
4
  tools: Read, Grep, Glob, Edit, Write, Bash, mcp__plugin_nativ_nativ
5
5
  model: sonnet
6
- effort: medium
7
- maxTurns: 40
6
+ effort: low
7
+ maxTurns: 20
8
8
  ---
9
9
 
10
10
  You are a **Worker** in a nativ workflow. Read `AGENTS.md` first; it defines every role and the task loop.
@@ -17,6 +17,7 @@ You are given one task id. Do that task and nothing else.
17
17
  2. Load only what the task needs: `.ai/subagents/<assignedSubagent>.md` and the contract slice `AGENTS.md` lists for that role. If the task has `specSlices`, read those first. Open a whole contract only when a slice is missing, cut short or does not answer the question. If it has `priorEscalations`, follow how each was settled; do not raise a settled gap again. If it has `learnings`, follow them.
18
18
  3. Change **only** the files in `targetFiles`. Match the style of the surrounding code and follow the contracts exactly: table and column names, routes and schemas, design tokens.
19
19
  Follow the `## Code style` rules in `AGENTS.md`: short lines, small functions, one UI component per file, brief plain comments.
20
+ Ensure UI components are pure, props-driven, and reusable. Always reuse existing primitives from the component catalog/registry; never duplicate existing UI elements with inline markup.
20
21
  4. Run the `verificationCommand`. If it fails, fix the cause and run it again. You have three fix attempts.
21
22
  5. If it still fails: `git checkout -- <targetFiles>`, then `nativ task block <taskId> --reason "Verification failed after 3 attempts: <short error>"`, then stop and report.
22
23
  6. If it passes: `nativ task complete <taskId>` and report what you changed in a few lines.
@@ -24,5 +25,7 @@ You are given one task id. Do that task and nothing else.
24
25
 
25
26
  ## Boundaries
26
27
 
27
- - A hook flags writes outside `targetFiles`. If a change outside them seems necessary, that is a contract or scope gap: run `nativ task escalate <taskId> --type architectural_ambiguity --details "..."` and stop. Do not edit the file anyway.
28
- - Never edit anything under `.ai/`. Never read or write `.env*` files or other secrets. Do not use `nativ task unlock`, `nativ db sync` or `--no-verify`.
28
+ - A hook flags writes outside `targetFiles` and safe peripheral files. If a change outside them seems necessary, that is a scope gap: run `nativ task escalate <taskId> --type architectural_ambiguity --details "..."` and stop.
29
+ - Never edit anything under `.ai/` directly. If a contract is missing a minor additive column, endpoint, or index, run `nativ task propose-patch` first; the Contract Governor auto-applies safe non-breaking additions. Only escalate if the change is destructive or ambiguous.
30
+ - Never read or write `.env*` files or other secrets. Do not use `nativ task unlock`, `nativ db sync` or `--no-verify`.
31
+
@@ -59,6 +59,7 @@ Applies to every worker. A project's own formatter or linter config wins over th
59
59
  - Lines: aim for 100 characters or fewer, hard maximum 120.
60
60
  - Functions: about 40 lines. Files: about 300 lines.
61
61
  - A growing UI file is split into components, one component per file.
62
+ - Reusable components: UI components must be pure, props-driven, and single-responsibility. Reuse shared components from the design system or component registry; never duplicate existing UI elements with inline custom markup.
62
63
  - Comments: at most 2 lines, explain why (not what), in plain everyday words with no technical jargon.
63
64
  - Do not restate the code in a comment. No banner or divider comments. No commented-out code.
64
65
  - Match the surrounding code.
@@ -1,45 +1,62 @@
1
- # Nativ Zero-Credential AI Air-Gap
2
- # Files that must never be read into an AI agent's context.
3
- # Database credentials live only in these files and in the local nativ process memory.
4
-
5
- # Environment files (connection strings, API keys, secrets)
6
- .env
7
- .env.*
8
- .env*.local
9
- **/.env
10
- **/.env.*
11
- !.env.example
12
- !**/.env.example
13
-
14
- # Nativ local runtime state (saved connections, session data)
15
- .nativ/*.local.json
16
- .agentj/*.local.json
17
- **/*.local.json
18
-
19
- # Private keys & certificates
20
- *.pem
21
- *.key
22
- *.p12
23
- *.pfx
24
- id_rsa*
25
- id_ed25519*
26
-
27
- # Local database files (may contain real data; agents only need .ai/db_schema.json)
28
- *.sqlite
29
- *.sqlite3
30
- *.db
31
- *.db-journal
32
- *.db-wal
33
- *.db-shm
34
-
35
- # Database dumps & backups
36
- *.dump
37
- *.sql.gz
38
- *.bak
39
-
40
- # Cloud & tooling credentials
41
- .npmrc
42
- .pgpass
43
- .my.cnf
44
- **/credentials.json
45
- **/service-account*.json
1
+ # Nativ Zero-Credential AI Air-Gap
2
+ # Files that must never be read into an AI agent's context.
3
+ # Database credentials live only in these files and in the local nativ process memory.
4
+
5
+ # Environment files (connection strings, API keys, secrets)
6
+ .env
7
+ .env.*
8
+ .env*.local
9
+ **/.env
10
+ **/.env.*
11
+ !.env.example
12
+ !**/.env.example
13
+
14
+ # Nativ local runtime state (saved connections, session data)
15
+ .nativ/*.local.json
16
+ .agentj/*.local.json
17
+ **/*.local.json
18
+
19
+ # Private keys & certificates
20
+ *.pem
21
+ *.key
22
+ *.p12
23
+ *.pfx
24
+ id_rsa*
25
+ id_ed25519*
26
+
27
+ # Local database files (may contain real data; agents only need .ai/db_schema.json)
28
+ *.sqlite
29
+ *.sqlite3
30
+ *.db
31
+ *.db-journal
32
+ *.db-wal
33
+ *.db-shm
34
+
35
+ # Database dumps & backups
36
+ *.dump
37
+ *.sql.gz
38
+ *.bak
39
+
40
+ # Cloud & tooling credentials
41
+ .npmrc
42
+ .pgpass
43
+ .my.cnf
44
+ **/credentials.json
45
+ **/service-account*.json
46
+
47
+ # Build outputs, compiler caches & coverage (token bloat prevention)
48
+ dist/
49
+ build/
50
+ coverage/
51
+ .next/
52
+ *.tsbuildinfo
53
+
54
+ # Isolated worktrees & dependency trees
55
+ .worktrees/
56
+ node_modules/
57
+
58
+ # Package manager lockfiles (massive non-code context)
59
+ package-lock.json
60
+ pnpm-lock.yaml
61
+ yarn.lock
62
+
@@ -51,6 +51,7 @@ Applies to every worker. A project's own formatter or linter config wins over th
51
51
  - Lines: aim for 100 characters or fewer, hard maximum 120.
52
52
  - Functions: about 40 lines. Files: about 300 lines.
53
53
  - A growing UI file is split into components, one component per file.
54
+ - Reusable components: UI components must be pure, props-driven, and single-responsibility. Reuse shared components from the design system or component registry; never duplicate existing UI elements with inline custom markup.
54
55
  - Comments: at most 2 lines, explain why (not what), in plain everyday words with no technical jargon.
55
56
  - Do not restate the code in a comment. No banner or divider comments. No commented-out code.
56
57
  - Match the surrounding code.
@@ -13,6 +13,19 @@ You are the **Project Manager** in this project's nativ workflow. `AGENTS.md` (i
13
13
  - You may not edit `.ai/`. If the enforcement hook warns about a file, that is a scope or contract gap: escalate with `nativ task escalate`, do not edit around it.
14
14
  - `nativ doctor` confirms the integration is intact. Run it after updating Claude Code or nativ, and whenever hooks or MCP tools seem to be missing.
15
15
 
16
+ ## Autonomous Execution (Hands-Free Loop)
17
+
18
+ When instructed to run autonomously (e.g. "run the queue", "execute milestone", or AFK mode):
19
+ 1. Call `nativ_task_next`.
20
+ 2. Start the task (`nativ_task_start`).
21
+ 3. Delegate to the `worker` agent with the task ID and recommended model.
22
+ 4. When the worker finishes, verify (`nativ_verify`).
23
+ 5. Complete the task (`nativ_task_complete`).
24
+ 6. **Immediately loop to the next task.** Do NOT pause between tasks or ask the human for permission to proceed.
25
+ 7. Stop ONLY when:
26
+ - All tasks in the milestone are completed: call the `verifier` agent for an independent milestone check, then notify the human.
27
+ - A task trips the circuit breaker or escalates: stop and present the four-part summary.
28
+
16
29
  ## Human-Centric Communication Protocol
17
30
 
18
31
  The human is the product owner, not a log reader. When you report a blocker, a trade-off or an escalation, use four parts and plain words:
@@ -45,9 +45,11 @@ Token limits: exactly two directions, style tiles only in Full, compact wirefram
45
45
  ## Task breakdown
46
46
 
47
47
  - About one component or endpoint per task, at most 5 files.
48
- - `acceptanceCriteria` in plain words, including which states apply (loading, empty, error).
48
+ - Reusable components first: If a UI element or primitive is needed across multiple views, create a dedicated foundational component task first and register it under the Shared Component Registry in `.ai/ui_specs.md` before dependent screen tasks.
49
+ - `acceptanceCriteria` in plain words, including which states apply (loading, empty, error) and which shared components must be reused.
49
50
  - `specRefs` point to exact sections, such as `ui_specs.md#appointment-list` or an `api_contracts.json` route.
50
51
  - `complexity` is `simple`, `standard` or `complex`.
52
+ - `verificationCommand` must be a targeted single-file test (e.g. `npx vitest run path/to/file.test.ts`), taking < 5s. Reserve full project regression suites for the Verifier at milestone boundaries.
51
53
  - Dependencies make parallel-safe work explicit: tasks that touch different files and need no result from each other have none between them.
52
54
 
53
55
  ```bash
@@ -55,7 +57,7 @@ nativ task add "Appointment list" --agent frontend \
55
57
  --spec-refs "ui_specs.md#appointment-list,api_contracts.json#GET /appointments" \
56
58
  --complexity standard \
57
59
  --accept "Shows name and time per row" --accept "Empty and error states shown" \
58
- --files src/components/AppointmentList.tsx --deps task-3 --verify "npm test"
60
+ --files src/components/AppointmentList.tsx --deps task-3 --verify "npx vitest run tests/unit/AppointmentList.test.tsx"
59
61
  ```
60
62
 
61
63
  ## Limits
@@ -18,7 +18,7 @@ You did not write this code, and that is the point: check it as a skeptic would.
18
18
  - table, column, route and schema names match `.ai/db_schema.json` and `.ai/api_contracts.json`
19
19
  - only the task's `targetFiles` changed, and no tests were deleted or weakened
20
20
  - no secrets, connection strings or data in code, logs, tests or commits
21
- - the `## Code style` rules in `AGENTS.md` are followed (lines over 120 characters, comments over 2 lines, oversized files or UI files with several components); report violations as findings
21
+ - the `## Code style` rules in `AGENTS.md` are followed (lines over 120 characters, comments over 2 lines, oversized files, UI files with several components, or duplicating existing shared UI components with inline custom markup); report violations as findings
22
22
  - errors are handled and inputs are validated at the boundary
23
23
  4. Report in short findings, most serious first. For each: the file and line, what is wrong, and why it matters. Separate confirmed problems from suspicions and say which is which.
24
24
  5. If you find nothing, say what you checked so the result can be trusted.
@@ -3,8 +3,8 @@ name: worker
3
3
  description: Implements exactly one nativ task inside its targetFiles and verifies it. Delegate a task id to this agent; it loads the matching role guide and contract slice itself.
4
4
  tools: Read, Grep, Glob, Edit, Write, Bash, mcp__nativ
5
5
  model: sonnet
6
- effort: medium
7
- maxTurns: 40
6
+ effort: low
7
+ maxTurns: 20
8
8
  ---
9
9
 
10
10
  You are a **Worker** in a nativ workflow. Read `AGENTS.md` first; it defines every role and the task loop.
@@ -17,6 +17,7 @@ You are given one task id. Do that task and nothing else.
17
17
  2. Load only what the task needs: `.ai/subagents/<assignedSubagent>.md` and the contract slice `AGENTS.md` lists for that role. If the task has `specSlices`, read those first. Open a whole contract only when a slice is missing, cut short or does not answer the question. If it has `priorEscalations`, follow how each was settled; do not raise a settled gap again. If it has `learnings`, follow them.
18
18
  3. Change **only** the files in `targetFiles`. Match the style of the surrounding code and follow the contracts exactly: table and column names, routes and schemas, design tokens.
19
19
  Follow the `## Code style` rules in `AGENTS.md`: short lines, small functions, one UI component per file, brief plain comments.
20
+ Ensure UI components are pure, props-driven, and reusable. Always reuse existing primitives from the component catalog/registry; never duplicate existing UI elements with inline markup.
20
21
  4. Run the `verificationCommand`. If it fails, fix the cause and run it again. You have three fix attempts.
21
22
  5. If it still fails: `git checkout -- <targetFiles>`, then `nativ task block <taskId> --reason "Verification failed after 3 attempts: <short error>"`, then stop and report.
22
23
  6. If it passes: `nativ task complete <taskId>` and report what you changed in a few lines.
@@ -24,5 +25,7 @@ You are given one task id. Do that task and nothing else.
24
25
 
25
26
  ## Boundaries
26
27
 
27
- - A hook flags writes outside `targetFiles`. If a change outside them seems necessary, that is a contract or scope gap: run `nativ task escalate <taskId> --type architectural_ambiguity --details "..."` and stop. Do not edit the file anyway.
28
- - Never edit anything under `.ai/`. Never read or write `.env*` files or other secrets. Do not use `nativ task unlock`, `nativ db sync` or `--no-verify`.
28
+ - A hook flags writes outside `targetFiles` and safe peripheral files. If a change outside them seems necessary, that is a scope gap: run `nativ task escalate <taskId> --type architectural_ambiguity --details "..."` and stop.
29
+ - Never edit anything under `.ai/` directly. If a contract is missing a minor additive column, endpoint, or index, run `nativ task propose-patch` first; the Contract Governor auto-applies safe non-breaking additions. Only escalate if the change is destructive or ambiguous.
30
+ - Never read or write `.env*` files or other secrets. Do not use `nativ task unlock`, `nativ db sync` or `--no-verify`.
31
+
@@ -1,66 +1,66 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "version": "1.0.0",
4
- "projectName": "{{PROJECT_NAME}}",
5
- "updatedAt": "{{TIMESTAMP}}",
6
- "baseUrl": "/api/v1",
7
- "authScheme": "Bearer JWT",
8
- "endpoints": [
9
- {
10
- "id": "health-check",
11
- "path": "/health",
12
- "method": "GET",
13
- "description": "System health and runtime status check",
14
- "auth": false,
15
- "request": {
16
- "headers": {},
17
- "queryParams": {},
18
- "pathParams": {},
19
- "body": null
20
- },
21
- "responses": {
22
- "200": {
23
- "description": "System is healthy and operational",
24
- "body": {
25
- "status": "ok",
26
- "uptime": "number",
27
- "timestamp": "string"
28
- }
29
- }
30
- }
31
- },
32
- {
33
- "id": "example-entity-list",
34
- "path": "/entities",
35
- "method": "GET",
36
- "description": "Demonstration collection endpoint. The architect updates this during Phase 1 API design.",
37
- "auth": true,
38
- "request": {
39
- "headers": {
40
- "Authorization": "Bearer <token>"
41
- },
42
- "queryParams": {
43
- "limit": "integer (optional, default 20)",
44
- "offset": "integer (optional, default 0)"
45
- },
46
- "pathParams": {},
47
- "body": null
48
- },
49
- "responses": {
50
- "200": {
51
- "description": "List of entities matching query filter",
52
- "body": {
53
- "data": "array of example_entity",
54
- "total": "integer"
55
- }
56
- },
57
- "401": {
58
- "description": "Unauthorized access missing or invalid token",
59
- "body": {
60
- "error": "Unauthorized"
61
- }
62
- }
63
- }
64
- }
65
- ]
66
- }
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "version": "1.0.0",
4
+ "projectName": "{{PROJECT_NAME}}",
5
+ "updatedAt": "{{TIMESTAMP}}",
6
+ "baseUrl": "/api/v1",
7
+ "authScheme": "Bearer JWT",
8
+ "endpoints": [
9
+ {
10
+ "id": "health-check",
11
+ "path": "/health",
12
+ "method": "GET",
13
+ "description": "System health and runtime status check",
14
+ "auth": false,
15
+ "request": {
16
+ "headers": {},
17
+ "queryParams": {},
18
+ "pathParams": {},
19
+ "body": null
20
+ },
21
+ "responses": {
22
+ "200": {
23
+ "description": "System is healthy and operational",
24
+ "body": {
25
+ "status": "ok",
26
+ "uptime": "number",
27
+ "timestamp": "string"
28
+ }
29
+ }
30
+ }
31
+ },
32
+ {
33
+ "id": "example-entity-list",
34
+ "path": "/entities",
35
+ "method": "GET",
36
+ "description": "Demonstration collection endpoint. The architect updates this during Phase 1 API design.",
37
+ "auth": true,
38
+ "request": {
39
+ "headers": {
40
+ "Authorization": "Bearer <token>"
41
+ },
42
+ "queryParams": {
43
+ "limit": "integer (optional, default 20)",
44
+ "offset": "integer (optional, default 0)"
45
+ },
46
+ "pathParams": {},
47
+ "body": null
48
+ },
49
+ "responses": {
50
+ "200": {
51
+ "description": "List of entities matching query filter",
52
+ "body": {
53
+ "data": "array of example_entity",
54
+ "total": "integer"
55
+ }
56
+ },
57
+ "401": {
58
+ "description": "Unauthorized access missing or invalid token",
59
+ "body": {
60
+ "error": "Unauthorized"
61
+ }
62
+ }
63
+ }
64
+ }
65
+ ]
66
+ }
@@ -1,38 +1,38 @@
1
- # Project Context & Guardrails
2
-
3
- ## 1. System Overview & Repository Profile
4
- - **Project Name:** {{PROJECT_NAME}}
5
- - **Repository Type:** {{REPOSITORY_TYPE}}
6
- - **Workspace Topology:** {{WORKSPACE_TOPOLOGY}}
7
- - **Primary Goal:** {{PROJECT_GOAL}}
8
-
9
- ## 2. Technology Stack & Ecosystem Manifests
10
- - **Language / Runtime:** {{DETECTED_RUNTIME}}
11
- - **Framework:** {{DETECTED_FRAMEWORK}}
12
- - **Database / ORM:** {{DETECTED_DATABASE_ORM}}
13
- - **ORM / Migration Config:** {{DETECTED_ORM_CONFIG}}
14
- - **Styling / UI Library:** {{DETECTED_STYLING}}
15
- - **Testing Framework:** {{DETECTED_TESTING}}
16
- - **Package Manager:** {{DETECTED_PACKAGE_MANAGER}}
17
- - **Discovered Manifests:** {{ECOSYSTEM_MANIFESTS}}
18
-
19
- ## 3. Architecture & Codebase Layout
20
- - **Source Root:** `{{SOURCE_ROOT}}`
21
- - **Core Pattern:** {{ARCHITECTURE_PATTERN}}
22
- - **Key Directories:**
23
- {{KEY_DIRECTORIES}}
24
-
25
- ## 4. Engineering Guardrails & Constraints
26
- 1. **Strict Role Pipeline (provider-agnostic):** Architect (designs contracts and resolves escalations) -> Project Manager (orchestrates the task loop) -> Workers (specialized sub-agents) -> Verifier (independent checks). Roles are fixed; the model or vendor behind a role is configurable. Claude Code is the default host for every role, and other agents can be plugged in.
27
- 2. **Zero Breaking Changes:** Avoid breaking existing public interfaces, CLI options, or database contracts without explicit migration strategies.
28
- 3. **Schema Authority:** Database modifications must strictly align with `.ai/db_schema.json`.
29
- 4. **UI Fidelity:** User interface components must strictly match `.ai/ui_specs.md`.
30
- 5. **Secrets & Security:** Never hardcode API keys, passwords, or tokens. Use environment variables. Validate all external inputs.
31
- 6. **Testing Requirement:** Every newly introduced endpoint, service, or complex component must include automated tests before marking tasks completed in `.ai/master_plan.json`.
32
-
33
- ## 5. Execution Boundaries (Sub-Agent Allocation)
34
- - **`backend`:** Core services, CLI logic, APIs, server runtime code, and route handlers.
35
- - **`frontend`:** Web application views, client components, or terminal UI presentation.
36
- - **`database`:** Schema definitions, ORM models, migrations, and seed scripts matching `.ai/db_schema.json`.
37
- - **`qa-tester`:** Unit tests, integration tests, and verification scripts.
38
- - **Specialized Units:** `flutter-developer`, `devops-agent`, `security-auditor`, `db-migration` when required.
1
+ # Project Context & Guardrails
2
+
3
+ ## 1. System Overview & Repository Profile
4
+ - **Project Name:** {{PROJECT_NAME}}
5
+ - **Repository Type:** {{REPOSITORY_TYPE}}
6
+ - **Workspace Topology:** {{WORKSPACE_TOPOLOGY}}
7
+ - **Primary Goal:** {{PROJECT_GOAL}}
8
+
9
+ ## 2. Technology Stack & Ecosystem Manifests
10
+ - **Language / Runtime:** {{DETECTED_RUNTIME}}
11
+ - **Framework:** {{DETECTED_FRAMEWORK}}
12
+ - **Database / ORM:** {{DETECTED_DATABASE_ORM}}
13
+ - **ORM / Migration Config:** {{DETECTED_ORM_CONFIG}}
14
+ - **Styling / UI Library:** {{DETECTED_STYLING}}
15
+ - **Testing Framework:** {{DETECTED_TESTING}}
16
+ - **Package Manager:** {{DETECTED_PACKAGE_MANAGER}}
17
+ - **Discovered Manifests:** {{ECOSYSTEM_MANIFESTS}}
18
+
19
+ ## 3. Architecture & Codebase Layout
20
+ - **Source Root:** `{{SOURCE_ROOT}}`
21
+ - **Core Pattern:** {{ARCHITECTURE_PATTERN}}
22
+ - **Key Directories:**
23
+ {{KEY_DIRECTORIES}}
24
+
25
+ ## 4. Engineering Guardrails & Constraints
26
+ 1. **Strict Role Pipeline (provider-agnostic):** Architect (designs contracts and resolves escalations) -> Project Manager (orchestrates the task loop) -> Workers (specialized sub-agents) -> Verifier (independent checks). Roles are fixed; the model or vendor behind a role is configurable. Claude Code is the default host for every role, and other agents can be plugged in.
27
+ 2. **Zero Breaking Changes:** Avoid breaking existing public interfaces, CLI options, or database contracts without explicit migration strategies.
28
+ 3. **Schema Authority:** Database modifications must strictly align with `.ai/db_schema.json`.
29
+ 4. **UI Fidelity:** User interface components must strictly match `.ai/ui_specs.md`.
30
+ 5. **Secrets & Security:** Never hardcode API keys, passwords, or tokens. Use environment variables. Validate all external inputs.
31
+ 6. **Testing Requirement:** Every newly introduced endpoint, service, or complex component must include automated tests before marking tasks completed in `.ai/master_plan.json`.
32
+
33
+ ## 5. Execution Boundaries (Sub-Agent Allocation)
34
+ - **`backend`:** Core services, CLI logic, APIs, server runtime code, and route handlers.
35
+ - **`frontend`:** Web application views, client components, or terminal UI presentation.
36
+ - **`database`:** Schema definitions, ORM models, migrations, and seed scripts matching `.ai/db_schema.json`.
37
+ - **`qa-tester`:** Unit tests, integration tests, and verification scripts.
38
+ - **Specialized Units:** `flutter-developer`, `devops-agent`, `security-auditor`, `db-migration` when required.
@@ -1,39 +1,39 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "version": "1.0.0",
4
- "projectName": "{{PROJECT_NAME}}",
5
- "updatedAt": "{{TIMESTAMP}}",
6
- "engine": "{{DETECTED_DATABASE_ENGINE}}",
7
- "tables": [
8
- {
9
- "name": "example_entity",
10
- "description": "Demonstration table definition. The architect updates this during Phase 1A.",
11
- "columns": [
12
- {
13
- "name": "id",
14
- "type": "UUID",
15
- "primaryKey": true,
16
- "nullable": false,
17
- "default": "gen_random_uuid()"
18
- },
19
- {
20
- "name": "created_at",
21
- "type": "TIMESTAMP",
22
- "primaryKey": false,
23
- "nullable": false,
24
- "default": "NOW()"
25
- },
26
- {
27
- "name": "updated_at",
28
- "type": "TIMESTAMP",
29
- "primaryKey": false,
30
- "nullable": false,
31
- "default": "NOW()"
32
- }
33
- ],
34
- "indexes": [],
35
- "foreignKeys": []
36
- }
37
- ],
38
- "migrations": []
39
- }
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "version": "1.0.0",
4
+ "projectName": "{{PROJECT_NAME}}",
5
+ "updatedAt": "{{TIMESTAMP}}",
6
+ "engine": "{{DETECTED_DATABASE_ENGINE}}",
7
+ "tables": [
8
+ {
9
+ "name": "example_entity",
10
+ "description": "Demonstration table definition. The architect updates this during Phase 1A.",
11
+ "columns": [
12
+ {
13
+ "name": "id",
14
+ "type": "UUID",
15
+ "primaryKey": true,
16
+ "nullable": false,
17
+ "default": "gen_random_uuid()"
18
+ },
19
+ {
20
+ "name": "created_at",
21
+ "type": "TIMESTAMP",
22
+ "primaryKey": false,
23
+ "nullable": false,
24
+ "default": "NOW()"
25
+ },
26
+ {
27
+ "name": "updated_at",
28
+ "type": "TIMESTAMP",
29
+ "primaryKey": false,
30
+ "nullable": false,
31
+ "default": "NOW()"
32
+ }
33
+ ],
34
+ "indexes": [],
35
+ "foreignKeys": []
36
+ }
37
+ ],
38
+ "migrations": []
39
+ }