hadara 0.3.0 → 0.3.2-rc.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.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <img alt="Stable npm release" src="https://img.shields.io/badge/npm-0.3.0-blue">
9
- <img alt="Source version" src="https://img.shields.io/badge/source-0.3.0-orange">
9
+ <img alt="Source version" src="https://img.shields.io/badge/source-0.3.2--rc.0-orange">
10
10
  <img alt="Node.js" src="https://img.shields.io/badge/node-%3E%3D22-brightgreen">
11
11
  <img alt="License" src="https://img.shields.io/badge/license-MIT-lightgrey">
12
12
  </p>
@@ -27,26 +27,22 @@ Current stable npm release:
27
27
  hadara@0.3.0
28
28
  ```
29
29
 
30
- Previous npm release candidate:
30
+ Current release candidate:
31
31
 
32
32
  ```text
33
- hadara@0.3.0-rc.2
33
+ hadara@0.3.2-rc.0
34
34
  ```
35
35
 
36
- The 0.3.0 line is the Phase 7 Surface Refactor. It organizes HADARA's existing task, evidence, proof, lifecycle, release, and document surfaces so agents can distinguish primary lifecycle commands, diagnostics, advanced surfaces, canonical documents, historical documents, and safe Markdown update boundaries.
36
+ The 0.3.2-rc.0 line is the Evidence v2 refactor release candidate. It hardens evidence writer metadata, exact resolution markers, durable evidence id discovery, canonical/derived evidence boundaries, and release-facing docs after the 0.3.1 post-publish recycle.
37
37
 
38
- Phase 7.x labels are internal implementation phases, not npm release-candidate labels. The stable `0.3.0` package is published through the approval-gated release path with explicit operator confirmation.
38
+ Phase labels are internal implementation phases, not npm release-candidate labels. The stable `0.3.0` package remains the default install target; the `0.3.2-rc.0` package is for explicit release-candidate evaluation.
39
39
 
40
40
  | Surface | Status |
41
41
  |---|---|
42
- | npm package | Primary release target. |
43
- | `hadara@0.2.0-rc.1` | Previous published npm RC. |
44
- | `hadara@0.2.0-rc.2` | Previous published npm RC. |
45
- | `hadara@0.2.0-rc.3` | Previous published npm RC. |
46
- | `hadara@0.3.0-rc.0` | Previous published npm RC; package metadata lacks the intended discovery fields. |
47
- | `hadara@0.3.0-rc.1` | Previous published npm RC; T-0301 publish evidence verified `npm view` returned `0.3.0-rc.1`. |
48
- | `hadara@0.3.0-rc.2` | Previous published npm RC; T-0310 publish evidence verified `npm view` returned `0.3.0-rc.2`. |
49
- | `hadara@0.3.0` | Current stable npm release. |
42
+ | Current stable | [`hadara@0.3.0`](docs/RELEASE_NOTES.md#030) |
43
+ | Current RC | [`hadara@0.3.2-rc.0`](docs/RELEASE_NOTES.md#032-rc0) |
44
+ | Previous RC | [`hadara@0.3.1-rc.1`](docs/RELEASE_NOTES.md#031-rc1) |
45
+ | Historical RCs | See [Release Notes](docs/RELEASE_NOTES.md). |
50
46
  | GitHub Release | Secondary target, approval-gated. |
51
47
  | Docker image | Deferred. |
52
48
  | PyPI/Python package | `hadara==0.2.0rc1` published preview bridge. |
@@ -73,6 +69,23 @@ npx hadara@0.3.0 help
73
69
  npx hadara@0.3.0 doctor --json
74
70
  ```
75
71
 
72
+ Evaluate the release candidate explicitly:
73
+
74
+ ```bash
75
+ npm install -g hadara@0.3.2-rc.0
76
+ npx hadara@0.3.2-rc.0 help
77
+ ```
78
+
79
+ For release or recycle evidence, prefer an isolated prefix install when PATH, global installs, or `npx` cache behavior may be stale:
80
+
81
+ ```bash
82
+ tmp="$(mktemp -d)"
83
+ npm --prefix "$tmp" install hadara@0.3.0
84
+ "$tmp/node_modules/.bin/hadara" version --json
85
+ ```
86
+
87
+ `npx hadara@0.3.0 ...` remains convenient for normal use. The isolated installed-bin path is stronger proof that the published package installed and executed from the intended package tree.
88
+
76
89
  ## What HADARA Gives You
77
90
 
78
91
  | Capability | Purpose |
@@ -115,7 +128,7 @@ The primary path is intentionally small:
115
128
  hadara task next --json
116
129
  hadara task create "implement a focused change" --json
117
130
  hadara task status --task T-XXXX --json
118
- hadara evidence add-command --task T-XXXX --summary "..." --result passed --idempotency-key "command:T-XXXX:check" --json
131
+ hadara evidence add-command --task T-XXXX --summary "..." --result passed --category validation --idempotency-key "command:T-XXXX:check" --json
119
132
  hadara task finish --task T-XXXX --json
120
133
  hadara task finish --task T-XXXX --execute --json
121
134
  # Finalize Task Capsule docs and tracked state docs before closing.
@@ -126,6 +139,19 @@ hadara task audit-close --task T-XXXX --json
126
139
  hadara handoff suggest --task T-XXXX --json
127
140
  ```
128
141
 
142
+ When `evidence add-command` uses both legacy `--result` and v2 `--outcome`, matching outcomes must agree with the legacy result. `recorded` and `not-applicable` outcomes keep legacy result `unknown`; incompatible combinations fail before evidence is appended.
143
+
144
+ Use `hadara evidence list --task T-XXXX` to discover evidence ids before writing exact resolution markers. Text output shows `[id] time | category/outcome | visibility | summary`; JSON output includes `id`, `idSource`, `idStability`, `persistedSchemaVersion`, `category`, `outcome`, and `tags`. For long-lived references, copy only durable persisted `ev:` ids:
145
+
146
+ ```bash
147
+ hadara evidence list --task T-XXXX
148
+ hadara evidence add-command --task T-XXXX --summary "Fix verified" --result passed --category validation --resolves ev:T-XXXX:aaaaaaaaaaaaaaaaaaaaaaaa --json
149
+ ```
150
+
151
+ Legacy compatibility ids are inspection-only and are not the preferred durable reference for `resolves:` or `supersedes:` examples.
152
+
153
+ Deferred Evidence v2 scope is explicit: rebuild preview/execute, `check-id`, `subject`, and a new add-command report schema id are future candidates, not current command behavior. Treat `evidence.jsonl` as canonical append-only evidence and `EVIDENCE.md` as a non-canonical human summary.
154
+
129
155
  Optional workflow compression is read-only. Use it separately when you want a compact current-stage report and next recommended action:
130
156
 
131
157
  ```bash
@@ -219,7 +245,7 @@ Dashboard, TUI, Hermes, MCP, installer, package, release, and run commands stay
219
245
 
220
246
  ## Safety Boundaries
221
247
 
222
- HADARA 0.3.0 is not:
248
+ HADARA 0.3.2-rc.0 is not:
223
249
 
224
250
  - a full agent runtime;
225
251
  - Rack/enterprise behavior;
@@ -255,6 +281,12 @@ AGENTS.md
255
281
 
256
282
  Portable/local state is not committed. Project docs, Task Capsules, and reduced public evidence are committed when they represent reproducible context.
257
283
 
284
+ ### Evidence Rebuild Boundary
285
+
286
+ `evidence.jsonl` is the canonical Task Capsule evidence source. `EVIDENCE.md` is a non-canonical human summary that can help review validation history, but it must not be treated as the source of truth for rebuild, migration, or resolution logic.
287
+
288
+ 0.3.2 does not implement `hadara evidence rebuild --json` or an execute mode. Future rebuild work must first define whether a difference is formatting regeneration, managed-section drift, or data inconsistency before reporting `wouldChange`. Any later write-capable rebuild flow must be dry-run-first, reviewed, and before-hash guarded before it rewrites derived Markdown.
289
+
258
290
  ## Development / Contributing
259
291
 
260
292
  Initialize a project:
@@ -292,19 +324,6 @@ node dist/cli/main.js doctor --json
292
324
  npm run check
293
325
  ```
294
326
 
295
- For HADARA-dev itself, Docker is the preferred validation path because host `node_modules` on mounted workspaces can be unreliable:
296
-
297
- ```bash
298
- npm run dev:docker-check
299
- npm run dev:docker-sync-build
300
- ```
301
-
302
- Focused validation:
303
-
304
- ```bash
305
- npm run test:focused -- tests/unit/release-dry-run.test.ts
306
- ```
307
-
308
327
  Optional integrations are not generated by `hadara init` and are not part of the default scaffold:
309
328
 
310
329
  ```bash
@@ -33,11 +33,18 @@ function createEvidenceCollectReport(projectRoot, input) {
33
33
  summary: input.summary,
34
34
  result: input.result,
35
35
  visibility: input.visibility,
36
+ category: input.category,
37
+ outcome: input.outcome,
38
+ tags: input.tags,
36
39
  idempotencyKey: input.idempotencyKey
37
40
  });
38
41
  }
39
42
  catch (error) {
40
- if (error instanceof workspace_1.WorkspaceFileError || error instanceof evidence_1.EvidenceArtifactPolicyError || error instanceof evidence_1.EvidenceAppendLockError) {
43
+ if (error instanceof workspace_1.WorkspaceFileError ||
44
+ error instanceof evidence_1.EvidenceArtifactPolicyError ||
45
+ error instanceof evidence_1.EvidenceAppendLockError ||
46
+ error instanceof evidence_1.EvidenceResultOutcomeMismatchError ||
47
+ error instanceof evidence_1.EvidenceTaskDirectoryError) {
41
48
  return {
42
49
  schemaVersion: 'hadara.evidence.collect.v1',
43
50
  command: 'evidence.collect',
@@ -4,6 +4,8 @@ exports.handleEvidenceCommand = handleEvidenceCommand;
4
4
  exports.parseEvidenceKind = parseEvidenceKind;
5
5
  exports.parseEvidenceResult = parseEvidenceResult;
6
6
  exports.parseEvidenceVisibility = parseEvidenceVisibility;
7
+ exports.parseEvidenceCategory = parseEvidenceCategory;
8
+ exports.parseEvidenceOutcome = parseEvidenceOutcome;
7
9
  const evidence_1 = require("../evidence/evidence");
8
10
  const evidence_json_1 = require("./evidence-json");
9
11
  const evidence_lint_1 = require("../services/evidence-lint");
@@ -24,7 +26,7 @@ function handleEvidenceCommand(input) {
24
26
  }
25
27
  else {
26
28
  for (const record of report.records) {
27
- console.log(`${record.time} | ${(0, evidence_1.persistedEvidenceKind)(record)} | ${(0, evidence_1.persistedEvidenceResult)(record)} | ${record.visibility} | ${record.summary}`);
29
+ console.log(`[${evidenceListDisplayId(record)}] ${record.time} | ${evidenceListCategory(record)}/${evidenceListOutcome(record)} | ${record.visibility} | ${record.summary}`);
28
30
  }
29
31
  for (const issue of report.issues) {
30
32
  console.log(`[${issue.severity}] ${issue.code}: ${issue.message}`);
@@ -76,9 +78,30 @@ function handleEvidenceCommand(input) {
76
78
  if (sub === 'add-command') {
77
79
  const taskId = (0, args_1.getRequiredStringOption)(input.args, '--task');
78
80
  const summary = (0, args_1.getStringOption)(input.args, '--summary') ?? 'Command completed.';
79
- const result = parseEvidenceResult((0, args_1.getStringOption)(input.args, '--result', 'unknown') ?? 'unknown');
81
+ const outcome = parseOptionalEvidenceOutcome((0, args_1.getStringOption)(input.args, '--outcome'));
82
+ const explicitResult = (0, args_1.getStringOption)(input.args, '--result');
83
+ const result = parseEvidenceResult(explicitResult ?? outcomeToLegacyResult(outcome));
84
+ const resultOutcomeIssue = (0, evidence_1.validateEvidenceResultOutcomeCompatibility)({ result, outcome });
85
+ if (resultOutcomeIssue) {
86
+ const report = {
87
+ schemaVersion: 'hadara.evidence.collect.v1',
88
+ command: 'evidence.add-command',
89
+ ok: false,
90
+ issues: [resultOutcomeIssue]
91
+ };
92
+ if (input.jsonOutput) {
93
+ console.log(JSON.stringify(report, null, 2));
94
+ }
95
+ else {
96
+ console.log(`[error] ${resultOutcomeIssue.code}: ${resultOutcomeIssue.message}`);
97
+ }
98
+ process.exitCode = 6;
99
+ return true;
100
+ }
80
101
  const visibility = parseEvidenceVisibility((0, args_1.getStringOption)(input.args, '--visibility', 'public') ?? 'public', (0, args_1.getFlag)(input.args, '--private'));
81
102
  const idempotencyKey = (0, args_1.getStringOption)(input.args, '--idempotency-key');
103
+ const category = parseOptionalEvidenceCategory((0, args_1.getStringOption)(input.args, '--category'));
104
+ const tags = resolutionTagsFromArgs(input.args);
82
105
  if (input.jsonOutput) {
83
106
  const report = (0, evidence_json_1.createEvidenceCollectReport)(input.projectRoot, {
84
107
  taskId,
@@ -86,6 +109,9 @@ function handleEvidenceCommand(input) {
86
109
  summary,
87
110
  result,
88
111
  visibility,
112
+ category,
113
+ outcome,
114
+ tags,
89
115
  idempotencyKey
90
116
  });
91
117
  console.log(JSON.stringify({ ...report, command: 'evidence.add-command' }, null, 2));
@@ -93,7 +119,7 @@ function handleEvidenceCommand(input) {
93
119
  process.exitCode = 6;
94
120
  }
95
121
  else {
96
- const appendResult = (0, evidence_1.appendEvidenceWithResult)(input.projectRoot, { taskId, kind: 'command-log', summary, result, visibility, idempotencyKey });
122
+ const appendResult = (0, evidence_1.appendEvidenceWithResult)(input.projectRoot, { taskId, kind: 'command-log', summary, result, visibility, category, outcome, tags, idempotencyKey });
97
123
  if (appendResult.existing) {
98
124
  console.log(`[HADARA] Command evidence already exists: ${persistedEvidenceId(appendResult.evidence)}`);
99
125
  }
@@ -140,6 +166,15 @@ function handleEvidenceCommand(input) {
140
166
  function persistedEvidenceId(record) {
141
167
  return record.schemaVersion === 'hadara.evidence.v2' && record.id ? record.id : 'evidence.jsonl';
142
168
  }
169
+ function evidenceListDisplayId(record) {
170
+ return record.id;
171
+ }
172
+ function evidenceListCategory(record) {
173
+ return record.category;
174
+ }
175
+ function evidenceListOutcome(record) {
176
+ return record.outcome;
177
+ }
143
178
  function parseEvidenceKind(value) {
144
179
  if (['test-log', 'command-log', 'diff-summary', 'screenshot', 'note'].includes(value)) {
145
180
  return value;
@@ -159,3 +194,46 @@ function parseEvidenceVisibility(value, privateFlag = false) {
159
194
  return value;
160
195
  throw new Error(`unsupported evidence visibility: ${value}`);
161
196
  }
197
+ function parseEvidenceCategory(value) {
198
+ if (['validation', 'implementation', 'release', 'security', 'policy', 'operation', 'decision', 'handoff', 'audit', 'note', 'observation'].includes(value)) {
199
+ return value;
200
+ }
201
+ throw new Error(`unsupported evidence category: ${value}`);
202
+ }
203
+ function parseEvidenceOutcome(value) {
204
+ if (value === 'passed' || value === 'failed' || value === 'blocked' || value === 'unknown' || value === 'recorded' || value === 'not-applicable') {
205
+ return value;
206
+ }
207
+ throw new Error(`unsupported evidence outcome: ${value}`);
208
+ }
209
+ function parseOptionalEvidenceCategory(value) {
210
+ return value ? parseEvidenceCategory(value) : undefined;
211
+ }
212
+ function parseOptionalEvidenceOutcome(value) {
213
+ return value ? parseEvidenceOutcome(value) : undefined;
214
+ }
215
+ function outcomeToLegacyResult(outcome) {
216
+ if (outcome === 'passed' || outcome === 'failed' || outcome === 'blocked' || outcome === 'unknown')
217
+ return outcome;
218
+ return 'unknown';
219
+ }
220
+ function resolutionTagsFromArgs(args) {
221
+ const tags = [];
222
+ for (const id of getRepeatedStringOptions(args, '--resolves'))
223
+ tags.push(`resolves:${id}`);
224
+ for (const id of getRepeatedStringOptions(args, '--supersedes'))
225
+ tags.push(`supersedes:${id}`);
226
+ return tags.length > 0 ? tags : undefined;
227
+ }
228
+ function getRepeatedStringOptions(args, option) {
229
+ const values = [];
230
+ for (let index = 0; index < args.length; index += 1) {
231
+ if (args[index] !== option)
232
+ continue;
233
+ const value = args[index + 1];
234
+ if (!value || value.startsWith('--'))
235
+ throw new Error(`missing value for ${option}`);
236
+ values.push(value);
237
+ }
238
+ return values;
239
+ }
package/dist/cli/init.js CHANGED
@@ -571,7 +571,7 @@ function sopRequiredReadingRowsForProfile(profile) {
571
571
  rows.push(['`docs/ARCHITECTURE.md`', 'Architecture, component, or boundary work', 'Current system shape and ownership boundaries.'], ['`docs/DEVELOPMENT_SLICES.md`', 'Starting, completing, or reclassifying slices', 'Roadmap ordering and completion evidence.'], ['`docs/DECISIONS.md`', 'Project-level decision work', 'Durable decisions that affect architecture or workflow.'], ['`docs/TEST_STRATEGY.md`', 'Validation planning or completion checks', 'Routine suites and special-case smoke boundaries.']);
572
572
  }
573
573
  if (profile === 'governed') {
574
- rows.push(['`docs/SECURITY_MODEL.md`', 'Security, secret, permission, or evidence-safety work', 'Project security invariants and special checks.'], ['`docs/REFACTOR_LOG.md`', 'Refactor, migration, removal, or replacement work', 'Project-level refactor history.'], ['`docs/ROADMAP.md`', 'Roadmap, milestone, or scope planning', 'Longer-term priorities and deferred work.']);
574
+ rows.push(['`docs/SECURITY_MODEL.md`', 'Security, secret, permission, or evidence-safety work', 'Project security invariants and special checks.'], ['`docs/ROADMAP.md`', 'Roadmap, milestone, or scope planning', 'Longer-term priorities and deferred work.']);
575
575
  }
576
576
  return rows;
577
577
  }
@@ -587,7 +587,7 @@ function agentsRequiredReadingRowsForProfile(profile) {
587
587
  rows.push({ document: '`docs/ARCHITECTURE.md`', when: 'Architecture, component, or boundary work', purpose: 'Current system shape and ownership boundaries.' }, { document: '`docs/DEVELOPMENT_SLICES.md`', when: 'Starting, completing, or reclassifying a development slice', purpose: 'Roadmap ordering, prerequisites, and completion evidence.' }, { document: '`docs/DECISIONS.md`', when: 'Project-level decision work', purpose: 'Durable project decisions.' }, { document: '`docs/TEST_STRATEGY.md`', when: 'Validation planning or completion checks', purpose: 'Routine suites and special-case checks.' });
588
588
  }
589
589
  if (profile === 'governed') {
590
- rows.push({ document: '`docs/SECURITY_MODEL.md`', when: 'Security, secret, permission, or evidence-safety work', purpose: 'Project security invariants.' }, { document: '`docs/REFACTOR_LOG.md`', when: 'Refactor, migration, removal, or replacement work', purpose: 'Project-level refactor history.' }, { document: '`docs/ROADMAP.md`', when: 'Roadmap, milestone, or scope planning', purpose: 'Longer-term priorities and deferred work.' });
590
+ rows.push({ document: '`docs/SECURITY_MODEL.md`', when: 'Security, secret, permission, or evidence-safety work', purpose: 'Project security invariants.' }, { document: '`docs/ROADMAP.md`', when: 'Roadmap, milestone, or scope planning', purpose: 'Longer-term priorities and deferred work.' });
591
591
  }
592
592
  return rows;
593
593
  }
@@ -710,7 +710,7 @@ function requiredDocsForProfile(profile) {
710
710
  docs.push('docs/ARCHITECTURE.md', 'docs/DEVELOPMENT_SLICES.md', 'docs/DECISIONS.md', 'docs/TEST_STRATEGY.md');
711
711
  }
712
712
  if (profile === 'governed') {
713
- docs.push('docs/SECURITY_MODEL.md', 'docs/REFACTOR_LOG.md', 'docs/ROADMAP.md');
713
+ docs.push('docs/SECURITY_MODEL.md', 'docs/ROADMAP.md');
714
714
  }
715
715
  return docs;
716
716
  }
@@ -973,9 +973,6 @@ function createImplementationSopDoc(spec) {
973
973
  if (spec.docs.securityModel) {
974
974
  requiredReadingRows.push(['`docs/SECURITY_MODEL.md`', 'Security, secret, permission, or evidence-safety work', 'Project security invariants and special checks.']);
975
975
  }
976
- if (spec.docs.refactorLog) {
977
- requiredReadingRows.push(['`docs/REFACTOR_LOG.md`', 'Refactor, migration, removal, or replacement work', 'Project-level refactor history.']);
978
- }
979
976
  if (spec.docs.roadmap) {
980
977
  requiredReadingRows.push(['`docs/ROADMAP.md`', 'Roadmap, milestone, release, or scope planning', 'Longer-term priorities and deferred work.']);
981
978
  }
@@ -1095,6 +1092,16 @@ Keep capsule docs current as work changes:
1095
1092
 
1096
1093
  Parallelize read-only discovery, \`rg\`/file inspection, independent validation commands, package or registry metadata inspection, read-only diagnostics, and draft preparation before writes. Serialize same-file writes, evidence append, Task Capsule doc writes, Task Board writes, Project State writes, Agent Handoff writes, before-hash execute operations, \`task finish --execute\`, \`task close --execute\`, and release artifact or publish operations.
1097
1094
 
1095
+ ## Status Token And Document Ownership Policy
1096
+
1097
+ Use distinct token families for persistent task state, close proof state, document registry state, and evidence outcomes. \`TaskStatus\` belongs to Task Capsule metadata, \`TASK.md\` Status/Status History, and command-owned \`docs/TASK_BOARD.md\` cells. Valid persistent task tokens are \`Draft\`, \`In Progress\`, \`Blocked\`, \`Done\`, \`Partial\`, \`Superseded\`, and \`Archived\`.
1098
+
1099
+ \`CloseState\` is derived from close evidence and \`task audit-close\`; do not write close proof values as \`TaskStatus\`, and do not persist \`CloseState\` in task-local \`HANDOFF.md\` close-source current-state tables. Canonical close-state tokens are \`not-closed\`, \`closed-valid\`, \`closed-stale\`, \`closed-invalid\`, and \`unknown\`. Compatibility diagnostics such as \`close-evidence-found-invalid\`, \`close-evidence-malformed\`, and \`closed-with-drift-warnings\` are close-state details, not task status.
1100
+
1101
+ \`DocStatus\` belongs only to the docs registry and uses \`canonical\`, \`active\`, \`reference\`, \`historical\`, \`superseded\`, and \`archived\`. Evidence outcomes are \`passed\`, \`failed\`, \`blocked\`, and \`unknown\`; preserve failed or blocked evidence and append newer corrective evidence instead of rewriting history.
1102
+
1103
+ Ownership boundaries follow the lifecycle command model. \`task finish --execute\` owns bounded status bookkeeping in \`TASK.md\` and command-owned \`docs/TASK_BOARD.md\` cells. \`task close --execute\` owns only close evidence append. Operators own close-source prose and shared state docs before close, then rerun ready/close/audit after any intentional close-source edit.
1104
+
1098
1105
  ## Standard Task Workflow Loop
1099
1106
 
1100
1107
  The authoritative command semantics live in \`docs/TASK_WORKFLOW_COMMANDS.md\`. For ordinary implementation capsules, use this loop:
@@ -1111,7 +1118,7 @@ hadara task status --task T-XXXX --json
1111
1118
 
1112
1119
  # Do the scoped work.
1113
1120
 
1114
- hadara evidence add-command --task T-XXXX --summary "..." --result passed --idempotency-key "command:T-XXXX:check" --json
1121
+ hadara evidence add-command --task T-XXXX --summary "..." --result passed --category validation --idempotency-key "command:T-XXXX:check" --json
1115
1122
 
1116
1123
  hadara task finish --task T-XXXX --json
1117
1124
  hadara task finish --task T-XXXX --execute --json
@@ -1133,7 +1140,7 @@ hadara task audit-close --task T-XXXX --json
1133
1140
  |---|---|---|
1134
1141
  | \`task next\` | Read-only | Recommends work; does not create tasks. |
1135
1142
  | \`task status\` | Read-only | \`ok\` means report generation succeeded; readiness is in \`state.ready\`, \`summary.blockers\`, and \`issues\`. |
1136
- | \`evidence add-command\` | Write | Appends command-log evidence; does not execute shell commands; optional \`--idempotency-key\` prevents duplicate same-key records. |
1143
+ | \`evidence add-command\` | Write | Appends command-log evidence; does not execute shell commands; optional \`--category\`/\`--outcome\`/\`--resolves\`/\`--supersedes\` enrich v2 metadata, result/outcome mismatches are rejected, and optional \`--idempotency-key\` prevents duplicate same-key records. |
1137
1144
  | \`task ready\` | Read-only | Checks readiness; does not mutate evidence or status docs. |
1138
1145
  | \`task finish\` | Dry-run by default; writes only with \`--execute\` | Bounded to \`TASK.md\` and \`docs/TASK_BOARD.md\`. |
1139
1146
  | \`task close\` | Dry-run by default; writes only with \`--execute\` | Bounded to close evidence append. |
@@ -1158,8 +1165,10 @@ Before running \`task ready\` and \`task close\`, finish all close-source edits:
1158
1165
  1. Do not hand-edit Task Capsule \`evidence.jsonl\`.
1159
1166
  2. Append evidence through HADARA commands so schema, visibility, and artifact-safety checks run consistently.
1160
1167
  3. Record failed or blocked checks honestly. Do not replace them later with optimistic summaries; add newer evidence that explains the fix or residual risk.
1161
- 4. Use \`hadara evidence add-command --task <task-id> --summary <text> --result passed|failed|blocked|unknown --json\` for command results when no artifact file is attached. Add \`--idempotency-key <key>\` when rerunning the same logical check should report one durable evidence identity instead of appending duplicates.
1162
- 5. Use \`hadara evidence lint --task <task-id> --json\` when evidence drift is suspected or before close if evidence files were touched manually by mistake.
1168
+ 4. Use \`hadara evidence list --task <task-id>\` to discover evidence ids and copy durable persisted \`ev:\` ids for long-lived \`--resolves\` or \`--supersedes\` references. Legacy compatibility ids are inspection-only and are not the preferred durable reference.
1169
+ 5. Use \`hadara evidence add-command --task <task-id> --summary <text> --result passed|failed|blocked|unknown --json\` for command results when no artifact file is attached. Add \`--category <category>\` or \`--outcome <outcome>\` when summary heuristics are not precise enough; if both \`--result\` and \`--outcome\` are supplied, matching outcomes must match the legacy result, while \`recorded\` and \`not-applicable\` require \`--result unknown\` or no explicit result. Use \`--resolves <ev:evidence-id>\` or \`--supersedes <ev:evidence-id>\` for exact v2 resolution markers from passed or recorded follow-up evidence, and \`--idempotency-key <key>\` when rerunning the same logical check should report one durable evidence identity instead of appending duplicates.
1170
+ 6. Use \`hadara evidence lint --task <task-id> --json\` when evidence drift is suspected or before close if evidence files were touched manually by mistake.
1171
+ 7. Treat Task Capsule \`evidence.jsonl\` as canonical append-only evidence and \`EVIDENCE.md\` as a non-canonical human summary. \`hadara evidence rebuild\` is not implemented in this scaffold; future rebuild work must define whether \`wouldChange\` means formatting regeneration, managed-section drift, or data inconsistency before preview semantics are safe, and any execute mode must be dry-run-first and before-hash guarded.
1163
1172
 
1164
1173
  ## Session End
1165
1174
 
@@ -1329,7 +1338,7 @@ hadara task status --task T-XXXX --json
1329
1338
 
1330
1339
  # Do the scoped work.
1331
1340
 
1332
- hadara evidence add-command --task T-XXXX --summary "..." --result passed --idempotency-key "command:T-XXXX:check" --json
1341
+ hadara evidence add-command --task T-XXXX --summary "..." --result passed --category validation --idempotency-key "command:T-XXXX:check" --json
1333
1342
 
1334
1343
  hadara task finish --task T-XXXX --json
1335
1344
  hadara task finish --task T-XXXX --execute --json
@@ -1353,6 +1362,68 @@ The close model has three separate phases: validation proves readiness, close re
1353
1362
 
1354
1363
  \`task ready\` and \`task close\` include done-level Task Capsule validation. Use \`hadara harness validate --task T-XXXX --level done --json\` directly when debugging capsule format, status-history, acceptance, evidence, or handoff validation failures.
1355
1364
 
1365
+ ## Status Token And Ownership Policy
1366
+
1367
+ HADARA uses separate token families for persistent state, derived proof state, document registry state, and evidence outcomes. Do not collapse these families into a single Markdown \`Status\` field.
1368
+
1369
+ ### TaskStatus
1370
+
1371
+ \`TaskStatus\` is persistent task lifecycle state in \`TASK.md\` metadata, the \`## Status\` section, Status History rows, and the command-owned cells of \`docs/TASK_BOARD.md\`.
1372
+
1373
+ | Token | Meaning | Writer |
1374
+ |---|---|---|
1375
+ | \`Draft\` | Task capsule exists but implementation is not started or not yet ready for done-level validation. | \`task create\`, worker docs |
1376
+ | \`In Progress\` | Work is actively being performed. | Worker docs |
1377
+ | \`Blocked\` | Work cannot proceed without a recorded blocker. | Worker docs |
1378
+ | \`Done\` | Scoped work is implemented and ready for done-level validation/close. | \`task finish --execute\` |
1379
+ | \`Partial\` | Deliberate partial completion with remaining scope deferred or split. | Worker/coordinator docs |
1380
+ | \`Superseded\` | Task has been replaced by another task or line. | Worker/coordinator docs |
1381
+ | \`Archived\` | Task is no longer active state and is retained only for history. | Worker/coordinator docs |
1382
+
1383
+ Reserved non-TaskStatus strings include \`Closed\`, \`Ready\`, \`Approved\`, \`Complete\`, \`closed-valid\`, \`not-closed\`, and phrases such as \`Done pending lifecycle close\`. Use \`TaskStatus: Done\`; get close proof state from \`task status\`, \`task audit-close\`, proof status, or \`state verify\` read models.
1384
+
1385
+ ### CloseState
1386
+
1387
+ \`CloseState\` is derived proof state from close evidence and \`task audit-close\`; it is not written as persistent \`TaskStatus\` and should not be stored in task-local \`HANDOFF.md\` current-state tables.
1388
+
1389
+ | Canonical Token | Meaning |
1390
+ |---|---|
1391
+ | \`not-closed\` | No valid close proof has been recorded. |
1392
+ | \`closed-valid\` | Close evidence exists and audit reports current/fresh proof. |
1393
+ | \`closed-stale\` | Close evidence exists but source or validation hashes drifted after close. |
1394
+ | \`closed-invalid\` | Close-like evidence exists but audit reports invalid shape, failed result, or mismatch. |
1395
+ | \`unknown\` | The projection cannot determine close state. |
1396
+
1397
+ Current compatibility read models may expose more specific diagnostic values such as \`close-evidence-found-invalid\`, \`close-evidence-malformed\`, or \`closed-with-drift-warnings\`. Treat those as CloseState diagnostics, not TaskStatus values.
1398
+
1399
+ ### DocStatus
1400
+
1401
+ \`DocStatus\` is stored in the document registry only.
1402
+
1403
+ | Token | Meaning |
1404
+ |---|---|
1405
+ | \`canonical\` | Core scaffold/current-state document. |
1406
+ | \`active\` | Active working document or task-work document. |
1407
+ | \`reference\` | Conditional reference document. |
1408
+ | \`historical\` | Historical context, never default required reading. |
1409
+ | \`superseded\` | Replaced by another registered document. |
1410
+ | \`archived\` | Retained only as archive candidate/history. |
1411
+
1412
+ ### EvidenceOutcome
1413
+
1414
+ Evidence outcome tokens are \`passed\`, \`failed\`, \`blocked\`, and \`unknown\`. Failed or blocked evidence must remain visible; add newer evidence that explains the fix or residual risk instead of editing old records.
1415
+
1416
+ ### Write Ownership
1417
+
1418
+ | Surface | Ownership |
1419
+ |---|---|
1420
+ | \`TASK.md\` status metadata, \`## Status\`, and Status History | Command-owned for finish bookkeeping; worker-owned before finish. |
1421
+ | \`docs/TASK_BOARD.md\` ID/title/status/capsule cells | Command-owned by \`task finish\`; Notes and extra cells are mixed/human-owned. |
1422
+ | \`EVIDENCE.md\` and \`evidence.jsonl\` | Evidence writer-owned; do not hand-edit \`evidence.jsonl\`. Treat \`evidence.jsonl\` as canonical and \`EVIDENCE.md\` as a non-canonical human summary; evidence rebuild is not implemented in this scaffold and any future execute mode must be dry-run-first and before-hash guarded. |
1423
+ | \`HANDOFF.md\` managed current-state table | Managed/mixed; persist \`TaskStatus\` only. \`CloseState\` is derived by status/audit/proof/state read models and should not be written into close-source handoff tables. |
1424
+ | Shared state docs | Mixed/human-owned; update before close when they are close-source relevant. |
1425
+ | \`.hadara/docs-registry.json\` and \`docs/DOC_REGISTRY.md\` | Docs registry-owned; registry mutations should stay dry-run-first or explicitly scoped. |
1426
+
1356
1427
  Before close, finish all close-source edits: Task Capsule docs, acceptance/tests/handoff notes, evidence summaries, \`docs/TASK_BOARD.md\`, and tracked state docs such as \`docs/PROJECT_STATE.md\`, \`docs/AGENT_HANDOFF.md\`, and roadmap/slice docs when they apply. After \`task close --execute --json\`, changing those documents changes the close source hash and requires rerunning \`task ready\`, \`task close\`, and \`task audit-close\`. Do not paste volatile close evidence ids into close-source docs; prefer stable wording such as "close evidence appended; audit returned closed-valid".
1357
1428
 
1358
1429
  ## Documentation Timing and Write Coordination
@@ -1370,7 +1441,7 @@ Serialize same-file writes, evidence append, Task Capsule doc writes, Task Board
1370
1441
  | \`task next\` | Read-only | Recommends work; does not create tasks. |
1371
1442
  | \`task status\` | Read-only | \`ok\` means report generation succeeded; readiness is in \`state.ready\`, \`summary.blockers\`, and \`issues\`. |
1372
1443
  | \`task create\` | Write | Creates a Draft Task Capsule and Task Board row. It does not imply the task is ready or done. |
1373
- | \`evidence add-command\` | Write | Appends operator-supplied command-log evidence. It does not execute shell commands or capture stdout/stderr; optional \`--idempotency-key\` prevents duplicate same-key records. |
1444
+ | \`evidence add-command\` | Write | Appends operator-supplied command-log evidence. It does not execute shell commands or capture stdout/stderr; optional \`--category\`/\`--outcome\`/\`--resolves\`/\`--supersedes\` enrich v2 metadata, result/outcome mismatches are rejected, and optional \`--idempotency-key\` prevents duplicate same-key records. |
1374
1445
  | \`task finish\` | Dry-run by default; writes only with \`--execute\` | Updates only \`TASK.md\` status bookkeeping and the matching \`docs/TASK_BOARD.md\` row. |
1375
1446
  | \`task ready\` | Read-only | Checks whether the task can satisfy the requested readiness level after finish. |
1376
1447
  | \`task complete\` | Read-only | Summarizes the current completion stage and next command; it does not execute lifecycle writes. |
@@ -1384,7 +1455,9 @@ Serialize same-file writes, evidence append, Task Capsule doc writes, Task Board
1384
1455
  - \`task ready\` checks readiness; it does not write evidence or status.
1385
1456
  - \`harness validate\` is a direct diagnostic for Task Capsule structure and done-level gates; it is not a replacement for close evidence.
1386
1457
  - \`task complete\` is a read-only workflow compressor. It may report the next lifecycle command, but it must not execute finish, ready, close, or audit commands.
1387
- - \`evidence add-command\` records an operator-supplied command result; it does not run the command. \`--idempotency-key\` is optional; when supplied, same-key repeats return the existing record without appending duplicate Markdown or JSONL rows.
1458
+ - \`evidence list\` is the supported evidence id discovery surface. Text output shows \`[id] time | category/outcome | visibility | summary\`; JSON records expose \`id\`, \`idSource\`, \`idStability\`, \`persistedSchemaVersion\`, \`category\`, \`outcome\`, and \`tags\`. Use durable persisted \`ev:\` ids for long-lived \`--resolves\` and \`--supersedes\` references. Legacy compatibility ids are inspection-only and are not the preferred durable reference.
1459
+ - \`evidence add-command\` records an operator-supplied command result; it does not run the command. \`--category\` and \`--outcome\` set persisted v2 metadata explicitly, while \`--result\` remains the legacy-compatible command result. When both are supplied, \`--result\` must match \`--outcome\` for \`passed\`, \`failed\`, \`blocked\`, and \`unknown\`; \`recorded\` and \`not-applicable\` require \`--result unknown\` or no explicit \`--result\`. \`--resolves\` and \`--supersedes\` append exact v2 resolution tags from passed or recorded follow-up evidence. \`--idempotency-key\` is optional; when supplied, same-key repeats return the existing record without appending duplicate Markdown or JSONL rows.
1460
+ - Evidence v2 deferred scope remains explicit: rebuild preview/execute, \`check-id\`, \`subject\`, and a new add-command report schema id are future candidates. Do not infer those commands or schema changes from the current \`evidence list\` and \`evidence add-command\` ergonomics.
1388
1461
  - \`task finish\` may update only the Task Capsule \`TASK.md\` status and the matching \`docs/TASK_BOARD.md\` row's command-owned cells: \`ID\`, \`Title\`, \`Status\`, and \`Capsule\`. It preserves human/mixed-owned \`Notes\` and any extra cells.
1389
1462
  - \`task close\` may append only close evidence. It must not update status docs, Task Board rows, handoff, Project State, roadmap docs, or arbitrary evidence.
1390
1463
  - After \`task close --execute --json\`, close-source document edits intentionally invalidate the previous close proof. Make those edits before close, or rerun ready/close/audit if the edit is unavoidable.
@@ -1415,8 +1488,6 @@ function createAgentsDoc(spec) {
1415
1488
  requiredReadingRows.push([String(order++), '`docs/TEST_STRATEGY.md`', 'Validation planning or completion checks', 'Routine suites and special-case checks.']);
1416
1489
  if (spec.docs.securityModel)
1417
1490
  requiredReadingRows.push([String(order++), '`docs/SECURITY_MODEL.md`', 'Security, secret, permission, or evidence-safety work', 'Project security invariants.']);
1418
- if (spec.docs.refactorLog)
1419
- requiredReadingRows.push([String(order++), '`docs/REFACTOR_LOG.md`', 'Refactor, migration, removal, or replacement work', 'Project-level refactor history.']);
1420
1491
  if (spec.docs.roadmap)
1421
1492
  requiredReadingRows.push([String(order++), '`docs/ROADMAP.md`', 'Roadmap, milestone, or scope planning', 'Longer-term priorities and deferred work.']);
1422
1493
  requiredReadingRows.push([String(order++), 'Active `tasks/T-*/TASK.md`', 'Working a task', 'Task-specific goal, scope, and status.'], [String(order++), 'Active Task Capsule docs', 'Working a task', 'Decisions, plan, context, acceptance, files, tests, risks, handoff, and evidence.'], [String(order++), 'Project-specific registered docs', 'When listed in `docs/IMPLEMENTATION_SOP.md`', 'Specs, contracts, or roadmap files explicitly added by this project.']);
package/dist/cli/main.js CHANGED
@@ -173,6 +173,12 @@ async function main(args = process.argv.slice(2)) {
173
173
  return;
174
174
  break;
175
175
  }
176
+ case 'state': {
177
+ const { handleStateCommand } = await Promise.resolve().then(() => __importStar(require('./state')));
178
+ if (handleStateCommand({ args, projectRoot: paths.projectRoot, jsonOutput }))
179
+ return;
180
+ break;
181
+ }
176
182
  case 'dashboard': {
177
183
  const { handleDashboardCommand } = await Promise.resolve().then(() => __importStar(require('./dashboard')));
178
184
  if (handleDashboardCommand({ args, projectRoot: paths.projectRoot }))
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleStateCommand = handleStateCommand;
4
+ const state_projection_1 = require("../services/state-projection");
5
+ function handleStateCommand(input) {
6
+ if (input.args[0] !== 'state' || input.args[1] !== 'verify')
7
+ return false;
8
+ const report = (0, state_projection_1.createStateProjectionReport)(input.projectRoot);
9
+ if (input.jsonOutput) {
10
+ console.log(JSON.stringify(report, null, 2));
11
+ }
12
+ else {
13
+ console.log((0, state_projection_1.formatStateProjectionReport)(report));
14
+ }
15
+ return true;
16
+ }
@@ -16,7 +16,7 @@ function handleOpsCommand(input) {
16
16
  return true;
17
17
  }
18
18
  function printStatus(projectRoot, jsonOutput) {
19
- const report = (0, operations_status_service_1.createOpsStatusReport)(projectRoot);
19
+ const report = (0, operations_status_service_1.createOpsStatusReport)(projectRoot, { includeStateConsistency: true });
20
20
  if (jsonOutput) {
21
21
  console.log(JSON.stringify(report, null, 2));
22
22
  }
@@ -49,6 +49,7 @@ const release_gate_schema_json_1 = __importDefault(require("../schemas/release-g
49
49
  const release_publish_schema_json_1 = __importDefault(require("../schemas/release-publish.schema.json"));
50
50
  const runtime_version_schema_json_1 = __importDefault(require("../schemas/runtime-version.schema.json"));
51
51
  const smoke_evidence_summary_schema_json_1 = __importDefault(require("../schemas/smoke-evidence-summary.schema.json"));
52
+ const state_projection_schema_json_1 = __importDefault(require("../schemas/state-projection.schema.json"));
52
53
  const task_audit_close_schema_json_1 = __importDefault(require("../schemas/task-audit-close.schema.json"));
53
54
  const task_close_schema_json_1 = __importDefault(require("../schemas/task-close.schema.json"));
54
55
  const task_complete_flow_schema_json_1 = __importDefault(require("../schemas/task-complete-flow.schema.json"));
@@ -115,6 +116,7 @@ const registeredSchemas = {
115
116
  'hadara.releasePublish.v1': release_publish_schema_json_1.default,
116
117
  'hadara.runtime.version.v1': runtime_version_schema_json_1.default,
117
118
  'hadara.smokeEvidenceSummary.v1': smoke_evidence_summary_schema_json_1.default,
119
+ 'hadara.stateProjection.v1': state_projection_schema_json_1.default,
118
120
  'hadara.task.audit_close.v1': task_audit_close_schema_json_1.default,
119
121
  'hadara.task.close.v1': task_close_schema_json_1.default,
120
122
  'hadara.task.complete_flow.v1': task_complete_flow_schema_json_1.default,