@planu/cli 8.5.1 → 8.7.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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +16 -4
  3. package/dist/sdd-engine/completion-guard.js +2 -3
  4. package/dist/sdd-engine/contracts.d.ts +172 -0
  5. package/dist/sdd-engine/contracts.js +235 -10
  6. package/dist/sdd-engine/evidence-checkpoints.d.ts +6 -0
  7. package/dist/sdd-engine/evidence-checkpoints.js +280 -0
  8. package/dist/sdd-engine/evidence-journal.d.ts +25 -0
  9. package/dist/sdd-engine/evidence-journal.js +326 -0
  10. package/dist/sdd-engine/feature-manifest.d.ts +2 -1
  11. package/dist/sdd-engine/host-rule-pack.d.ts +4 -0
  12. package/dist/sdd-engine/host-rule-pack.js +114 -55
  13. package/dist/sdd-engine/host-skill-reader.d.ts +8 -1
  14. package/dist/sdd-engine/host-skill-reader.js +73 -0
  15. package/dist/sdd-engine/resume-history.d.ts +35 -3
  16. package/dist/sdd-engine/resume-history.js +242 -13
  17. package/dist/sdd-engine/resume-views.d.ts +7 -6
  18. package/dist/sdd-engine/resume-views.js +246 -114
  19. package/dist/sdd-engine/task-content.d.ts +2 -1
  20. package/dist/sdd-engine/task-failures.d.ts +30 -13
  21. package/dist/sdd-engine/task-failures.js +284 -115
  22. package/dist/sdd-engine/task-window.d.ts +6 -3
  23. package/dist/sdd-engine/task-window.js +12 -23
  24. package/dist/sdd-engine/tools/compact-result.d.ts +35 -5
  25. package/dist/sdd-engine/tools/compact-result.js +279 -2
  26. package/dist/sdd-engine/tools/execution-tools.js +20 -9
  27. package/dist/sdd-engine/tools/workspace-tools.js +80 -51
  28. package/dist/sdd-engine/trinity-structure.d.ts +2 -2
  29. package/dist/sdd-engine/verification-inputs.d.ts +2 -1
  30. package/dist/sdd-engine/verification-policy.d.ts +7 -6
  31. package/dist/sdd-engine/verification-policy.js +74 -85
  32. package/dist/sdd-engine/verification-preflight.d.ts +9 -7
  33. package/dist/sdd-engine/verification-preflight.js +108 -89
  34. package/dist/sdd-engine/verification-receipts.d.ts +2 -2
  35. package/dist/sdd-engine/verification-receipts.js +2 -1
  36. package/dist/sdd-engine/verification-runner.d.ts +3 -1
  37. package/dist/sdd-engine/verification-runner.js +12 -7
  38. package/dist/types/completion.d.ts +183 -3
  39. package/dist/types/resume-views.d.ts +221 -2
  40. package/dist/types/sdd-engine.d.ts +52 -112
  41. package/dist/types/verification.d.ts +26 -9
  42. package/package.json +5 -5
  43. package/templates/AGENTS.md +4 -0
  44. package/templates/host/planu-sdd.md +4 -0
  45. package/templates/skills/preflight-guardian.md +4 -0
  46. package/templates/skills/reconciler.md +6 -0
  47. package/templates/skills/spec-architect.md +44 -0
  48. package/templates/skills/spec-executor.md +6 -0
  49. package/templates/skills/verification-auditor.md +6 -0
  50. package/dist/sdd-engine/tools/format-result.d.ts +0 -3
  51. package/dist/sdd-engine/tools/format-result.js +0 -22
@@ -1,79 +1,10 @@
1
- import type { KeyObject } from 'node:crypto';
2
- import type { BigIntStats } from 'node:fs';
3
- export type VerificationInputCategory = 'candidate' | 'observed';
4
- export type VerificationInputReason = 'receipt_input_unavailable' | 'receipt_input_drift' | 'cancelled';
5
- export interface InputRequest {
6
- category: VerificationInputCategory;
7
- path: string;
8
- allowAbsent: boolean;
9
- }
10
- interface WalkBase {
11
- directories: readonly BigIntStats[];
12
- absolute: string;
13
- }
14
- export type Walk = WalkBase & ({
15
- state: 'absent';
16
- } | {
17
- state: 'present';
18
- stat: BigIntStats;
19
- });
20
- export type InputCapture = {
21
- request: InputRequest;
22
- walk: WalkBase & {
23
- state: 'absent';
24
- };
25
- } | {
26
- request: InputRequest;
27
- walk: WalkBase & {
28
- state: 'present';
29
- stat: BigIntStats;
30
- };
31
- rawSha256: string;
32
- mode: number;
33
- };
34
- export interface WorkspaceRoot {
35
- canonical: string;
36
- stat: BigIntStats;
37
- }
38
- export interface VerificationInputSnapshot {
39
- workspaceSha256: string;
40
- candidateSha256: string;
41
- observedSha256: string;
42
- root: WorkspaceRoot;
43
- workspaceRoot: string;
44
- inputs: readonly InputCapture[];
45
- }
46
- export interface TaskBlock {
47
- id: string;
48
- explicitId: string | undefined;
49
- legacyId: string | undefined;
50
- ordinal: number;
51
- lineIndex: number;
52
- lines: string[];
53
- }
1
+ import type { VerificationBudgetDiagnostic, VerificationProcessEvidence } from './verification.js';
54
2
  export type TrinityRule = 'out_of_scope' | 'error_matrix' | 'bdd' | 'frozen_dependencies' | 'manifest_path' | 'checkbox_task' | 'glob_delete' | 'protected_write' | 'receipt_policy_invalid' | 'artifact_missing' | 'artifact_unreadable';
55
3
  export interface TrinityIssue {
56
4
  artifact: 'spec.md' | 'plan.md' | 'tasks.md';
57
5
  rule: TrinityRule;
58
6
  line?: number;
59
7
  }
60
- export interface ManifestEntry {
61
- rawPath: string;
62
- permission: FilePermission;
63
- line: number;
64
- }
65
- export interface PolicySourceFrame {
66
- path: string;
67
- root: boolean;
68
- kind: 'object' | 'array';
69
- indent: number;
70
- nextArrayIndex: number;
71
- }
72
- export interface ReceiptPolicyText {
73
- locations?: ReadonlyMap<string, number>;
74
- text: string | null | undefined;
75
- line?: number;
76
- }
77
8
  export interface ReceiptSealFailure {
78
9
  ok: false;
79
10
  code: 'ERR_TRINITY_INCOMPLETE';
@@ -92,11 +23,6 @@ export type VerificationReceipt = Omit<VerificationEvidence, 'gates'> & {
92
23
  evidenceSha256: string;
93
24
  signature: string;
94
25
  };
95
- export interface SignedVerificationReceipt {
96
- receipt: VerificationReceipt;
97
- message: readonly string[];
98
- signature: Buffer;
99
- }
100
26
  export type ReceiptRejectionReason = 'receipt_malformed' | 'receipt_missing' | 'receipt_duplicate' | 'receipt_unexpected' | 'receipt_invalid_signature' | 'receipt_context_mismatch' | 'receipt_candidate_mismatch' | 'receipt_observed_mismatch' | 'receipt_procedure_mismatch' | 'receipt_environment_mismatch' | 'receipt_non_pass';
101
27
  export type ReceiptSetResult = {
102
28
  ok: true;
@@ -112,12 +38,13 @@ export interface GateAssessment {
112
38
  state: 'receipt_valid' | 'receipt_missing' | 'receipt_rejected';
113
39
  reason?: ReceiptRejectionReason;
114
40
  }
115
- export type PreflightBlockerReason = ReceiptRejectionReason | 'unlocked' | 'command_missing' | 'platform_unsupported' | 'receipt_input_unavailable' | 'receipt_observed_baseline_drift' | 'receipt_scoped_unsupported' | 'receipt_not_configured';
41
+ export type PreflightBlockerReason = ReceiptRejectionReason | 'unlocked' | 'command_missing' | 'platform_unsupported' | 'receipt_input_unavailable' | 'receipt_observed_baseline_drift' | 'receipt_scoped_unsupported' | 'receipt_not_configured' | 'verification_policy_mismatch' | 'verification_policy_workspace_mismatch' | 'verification_state_unavailable' | 'verification_in_progress' | 'verification_grant_consumed' | 'verification_grant_quarantined';
116
42
  interface PreflightBlocker {
117
43
  reason: PreflightBlockerReason;
118
44
  }
119
- export type PreflightAction = 'fix_inputs' | 'review_observed_drift' | 'obtain_receipts' | 'use_supported_runtime' | 'review_lock' | 'restore_verification' | 'attempt_integration' | 'none';
45
+ export type PreflightAction = 'fix_inputs' | 'review_observed_drift' | 'obtain_receipts' | 'use_supported_runtime' | 'review_lock' | 'review_verification_policy' | 'restore_verification' | 'attempt_integration' | 'none';
120
46
  export interface VerificationPreflight {
47
+ budget?: VerificationBudgetDiagnostic;
121
48
  version: 1;
122
49
  taskId: string | null;
123
50
  status: 'blocked' | 'ready_to_attempt' | 'not_applicable';
@@ -131,31 +58,6 @@ export interface ReceiptSetAssessment {
131
58
  gates: GateAssessment[];
132
59
  blockers: PreflightBlocker[];
133
60
  }
134
- export interface ReceiptTaskPolicy {
135
- taskId: string;
136
- gates: readonly VerificationGate[];
137
- observed: readonly string[];
138
- observedBaselineSha256: string;
139
- command: string;
140
- ordinal: number;
141
- lineIndex: number;
142
- }
143
- export interface ReceiptCandidate {
144
- path: string;
145
- requiredFrom: number;
146
- }
147
- export type ReceiptPolicyResult = {
148
- status: 'none';
149
- } | {
150
- status: 'invalid';
151
- taskId?: string;
152
- issue?: TrinityIssue;
153
- } | {
154
- status: 'ready';
155
- publicKey: KeyObject;
156
- candidates: readonly ReceiptCandidate[];
157
- tasks: ReadonlyMap<string, ReceiptTaskPolicy>;
158
- };
159
61
  export type ArtifactType = 'spec' | 'plan' | 'tasks';
160
62
  export type FilePermission = 'CREATE' | 'MODIFY' | 'READ_ONLY' | 'DELETE';
161
63
  export type ErrorCode = 'ERR_FEATURE_NOT_FOUND' | 'ERR_FEATURE_ALREADY_EXISTS' | 'ERR_SPEC_NOT_LOCKED' | 'ERR_SPEC_ALREADY_LOCKED' | 'ERR_SPEC_DRIFT' | 'ERR_TASK_OUT_OF_SEQUENCE' | 'ERR_TASK_NOT_FOUND' | 'ERR_FILE_OUT_OF_MANIFEST' | 'ERR_PERMISSION_VIOLATION' | 'ERR_PATCH_FAILED' | 'ERR_INVALID_ARTIFACT' | 'ERR_INVALID_SLICE' | 'ERR_WORKSPACE_UNRESOLVED' | 'ERR_TRINITY_INCOMPLETE' | 'ERR_LOCK_REASON_REQUIRED' | 'ERR_VERIFICATION_MISSING' | 'ERR_VERIFICATION_FAILED';
@@ -180,13 +82,44 @@ export interface InitWorkspaceInput {
180
82
  }
181
83
  export interface ListFeaturesInput {
182
84
  status_filter?: 'all' | 'planning' | 'executing' | 'done';
85
+ view?: 'setup_diagnostics';
86
+ host?: 'all' | 'claude' | 'cursor' | 'codex' | 'gemini';
183
87
  }
184
88
  export interface CreateFeatureInput {
185
89
  id?: string;
186
90
  title: string;
187
91
  }
92
+ export interface CheckpointJournalReference {
93
+ snapshotSha256: string;
94
+ headSha256: string;
95
+ count: number;
96
+ }
97
+ export interface CheckpointReported {
98
+ kind: 'smoke' | 'required_gate' | 'review' | 'progress';
99
+ outcome: 'pass' | 'fail' | 'pending' | 'blocked' | 'skipped' | 'partial';
100
+ cause: 'implementation_checkpoint' | 'check_passed' | 'check_failed' | 'required_evidence_pending' | 'evidence_invalidated' | 'environment_blocked' | 'review_requested' | 'review_passed' | 'review_failed' | 'contract_change_proposed';
101
+ gateId: string | null;
102
+ evidenceSha256: string | null;
103
+ reviewRefSha256: string | null;
104
+ }
105
+ export interface EvidenceCheckpointInput {
106
+ version: 1;
107
+ expectedSnapshotSha256: string;
108
+ expectedJournal: CheckpointJournalReference | null;
109
+ reported: CheckpointReported;
110
+ }
111
+ export interface EvidenceCheckpointResult {
112
+ version: 1;
113
+ seq: number;
114
+ recordSha256: string;
115
+ journal: CheckpointJournalReference;
116
+ certification: 'none';
117
+ }
188
118
  export interface LockSpecInput {
189
119
  feature_id: string;
120
+ operation?: 'lock' | 'evidence_checkpoint';
121
+ task_id?: string;
122
+ checkpoint?: EvidenceCheckpointInput;
190
123
  relock?: boolean;
191
124
  reason?: string;
192
125
  }
@@ -203,9 +136,24 @@ export interface RelockHistoryCursor {
203
136
  snapshotSha256: string;
204
137
  startIndex: number;
205
138
  }
139
+ export interface ExecutionDetailCursor {
140
+ snapshotSha256: string;
141
+ journalSnapshotSha256: string | null;
142
+ section: 'write_scope' | 'read_scope' | 'active_task' | 'verification';
143
+ offset: number;
144
+ contentSha256: string;
145
+ }
146
+ export interface EvidenceHistoryCursor {
147
+ snapshotSha256: string;
148
+ journalSnapshotSha256: string;
149
+ headSha256: string;
150
+ startSeq: number;
151
+ }
206
152
  export interface GetActiveTaskInput {
207
153
  feature_id: string;
208
- view?: 'verification_preflight' | 'resume' | 'relock_history';
154
+ view?: 'verification_preflight' | 'resume' | 'relock_history' | 'execution_window' | 'execution_detail' | 'evidence_history';
155
+ execution_cursor?: ExecutionDetailCursor;
156
+ evidence_cursor?: EvidenceHistoryCursor;
209
157
  history_cursor?: RelockHistoryCursor;
210
158
  verification_receipts?: Record<string, unknown>[];
211
159
  }
@@ -267,6 +215,7 @@ export interface ActiveTaskResult {
267
215
  verificationPreflight?: VerificationPreflight;
268
216
  }
269
217
  export interface CompleteTaskResult {
218
+ verificationProcess?: VerificationProcessEvidence;
270
219
  completedTaskId: string;
271
220
  verificationSummary: string;
272
221
  remainingTasks: number;
@@ -276,15 +225,6 @@ export interface CompleteTaskResult {
276
225
  receiptSetSha256: string;
277
226
  };
278
227
  }
279
- export interface TaskParseAccumulator {
280
- totalTasks: number;
281
- completedTasks: number;
282
- activeTaskIndex: number;
283
- activeTaskId: string;
284
- activeTaskTitle: string;
285
- activeTaskLines: string[];
286
- isCapturingActive: boolean;
287
- }
288
228
  export interface FeatureSummary {
289
229
  id: string;
290
230
  status: 'planning' | 'executing' | 'done';
@@ -1,4 +1,3 @@
1
- import type { SddResult, CompleteTaskResult } from './sdd-engine.js';
2
1
  export type VerificationPolicyInput = Readonly<{
3
2
  version: 1;
4
3
  mode: 'disabled';
@@ -48,7 +47,6 @@ export type ScopedTaskSelector = (content: string) => ScopedTaskSelection | null
48
47
  export type ScopedPolicy = Extract<VerificationPolicy, {
49
48
  mode: 'scoped';
50
49
  }>;
51
- export type ScopedSnapshotResult = SddResult<ScopedVerificationSnapshot>;
52
50
  export interface ScopedVerificationRun {
53
51
  readonly ok: boolean;
54
52
  readonly exitCode: number | null;
@@ -72,12 +70,31 @@ export interface ScopedVerificationRunnerTiming {
72
70
  readonly pollIntervalMs?: number;
73
71
  }
74
72
  export type VerificationGroupState = 'absent' | 'present' | 'unknown';
75
- export interface ScopedVerificationCompletionContext {
76
- readonly tasksPath: string;
77
- readonly taskId: string;
78
- readonly workspaceRoot: string;
79
- readonly selectTask: ScopedTaskSelector;
80
- readonly signal?: AbortSignal;
81
- readonly commit: (snapshot: ScopedVerificationSnapshot, output: string, signal: AbortSignal) => Promise<SddResult<CompleteTaskResult>>;
73
+ export type VerificationBudgetDiagnostic = Readonly<{
74
+ version: 1;
75
+ admission: 'default';
76
+ effectiveTimeoutMs: 180000;
77
+ reason: 'default_policy' | 'outside_scoped_grant';
78
+ }> | Readonly<{
79
+ version: 1;
80
+ admission: 'scoped';
81
+ effectiveTimeoutMs: number;
82
+ reason: 'trusted_startup_match';
83
+ }> | Readonly<{
84
+ version: 1;
85
+ admission: 'denied';
86
+ effectiveTimeoutMs: null;
87
+ reason: 'no_active_task' | 'unlocked' | 'command_missing' | 'platform_unsupported' | 'receipt_scoped_unsupported' | 'verification_policy_mismatch' | 'verification_policy_workspace_mismatch' | 'verification_state_unavailable' | 'verification_in_progress' | 'verification_grant_consumed' | 'verification_grant_quarantined';
88
+ }>;
89
+ export interface VerificationProcessEvidence {
90
+ readonly version: 1;
91
+ readonly timeoutMs: number;
92
+ readonly timedOut: boolean;
93
+ readonly cancelled: boolean;
94
+ readonly exitCode: number | null;
95
+ readonly signal: NodeJS.Signals | null;
96
+ readonly cleanupComplete: boolean;
97
+ readonly cleanupScope: 'owned_process_group';
98
+ readonly fixturePostconditions: 'unknown';
82
99
  }
83
100
  //# sourceMappingURL=verification.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planu/cli",
3
- "version": "8.5.1",
3
+ "version": "8.7.0",
4
4
  "description": "Planu — MCP server for Spec Driven Development. Planning and file operations on macOS/Linux/Windows; automated verification requires macOS/Linux (POSIX).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -86,17 +86,17 @@
86
86
  "happy-dom": "^21.0.4",
87
87
  "husky": "^9.1.7",
88
88
  "jiti": "2.7.0",
89
- "knip": "^6.44.1",
89
+ "knip": "^6.45.1",
90
90
  "lint-staged": "^17.6.0",
91
91
  "madge": "^8.0.0",
92
- "prettier": "^3.9.10",
92
+ "prettier": "^3.10.1",
93
93
  "qrcode": "1.5.4",
94
94
  "secretlint": "^13.1.0",
95
95
  "tsc-alias": "^1.9.10",
96
96
  "type-coverage": "^2.31.2",
97
97
  "typescript": "npm:@typescript/typescript6@^6.0.2",
98
- "typescript-eslint": "^8.72.1",
99
- "vite": "^8.3.6",
98
+ "typescript-eslint": "^8.72.2",
99
+ "vite": "^8.3.8",
100
100
  "vitest": "^5.1.0"
101
101
  },
102
102
  "scripts": {
@@ -19,6 +19,10 @@ To resume, request `sdd_get_active_task` with `view="resume"` and optional `veri
19
19
 
20
20
  If `history` is null, follow `nextAction` without requesting history. If `history.firstCursor` is null, there are no records; do not request history. Otherwise use `view="relock_history"` with the checkpoint's `history.firstCursor` as `history_cursor`, then each `nextCursor`, to read at most eight descending records per page. `history_cursor` is accepted only with `view="relock_history"`. Stop when `nextCursor` is null. Require `data.relockHistory.version=1`; stale cursors require rereading the checkpoint. Each handler-produced compact result has exactly one text block of at most 8,192 UTF-8 bytes, without `structuredContent`; SDK validation before dispatch is a separate boundary. History digests reference the original unmodified lock; they do not attest historical actions. Preserve guards, locked authority and verification budgets.
21
21
 
22
+ For supported connections, inspect `sdd_list_features` with `view="setup_diagnostics"` and an optional fixed `host`; server registration, installed file hashes and client-reported identity do not prove the host-effective catalogue. Reload the client catalogue only when needed. For a locked task use `execution_window`, follow its `execution_detail` cursors and `evidence_history` pages; reread the window when a cursor is stale. These views are non-certifying. Explicitly record an already observed attempt with `sdd_lock_spec(operation="evidence_checkpoint")` only after inspecting the selected connection’s advertised input schema for `operation`, `checkpoint` and `task_id` and confirming a supporting engine version. The global 8.5.1 server does not gain new inputs from source edits: never probe an unknown mutation, or fall back to lock/relock, because old schemas may strip fields and seal instead. Report unsupported capability. The journal retains only explicitly recorded observations; failures are not recorded automatically. Its caller-reported outcome is not certification; the server captures identity and eligible digests. Preserve uncertain guards for operator review.
23
+
24
+ Before attempting completion, request a fresh explicit `verification_preflight` or `resume` and require `budget.version=1`; absence is unavailable, never a grant. An older producer may omit it. The observation is advisory, not a reservation or grant. `execution_window` and `execution_detail` are not decorated with budget and cannot substitute for that fresh request. When a verification process actually ran, its `verificationProcess` reports the effective timeout, outcome and owned process group cleanup; `fixturePostconditions` remains `unknown`. Group cleanup alone does not prove fixture safety. These diagnostics do not record attempts automatically or authorize policy changes, retries or extra time. Reconcile uncertain state before acting.
25
+
22
26
  ## Delegation
23
27
 
24
28
  Delegate useful independent work within the active TASK through available native agents; keep trivial/dependent work sequential. Load the bounded protocol from `spec-executor.md` on demand; use `spec-architect.md` for workstream routing and `verification-auditor.md` for provenance checks. The parent alone applies canonical patches and certifies. Preserve all nine tools, lock, File Manifest, limits and protected-root controls; host capabilities grant no extra authority.
@@ -18,6 +18,10 @@ To resume, request `sdd_get_active_task` with `view="resume"` and optional `veri
18
18
 
19
19
  If `history` is null, follow `nextAction` without requesting history. If `history.firstCursor` is null, there are no records; do not request history. Otherwise use `view="relock_history"` with the checkpoint's `history.firstCursor` as `history_cursor`, then each `nextCursor`, to read at most eight descending records per page. `history_cursor` is accepted only with `view="relock_history"`. Stop when `nextCursor` is null. Require `data.relockHistory.version=1`; stale cursors require rereading the checkpoint. Each handler-produced compact result has exactly one text block of at most 8,192 UTF-8 bytes, without `structuredContent`; SDK validation before dispatch is a separate boundary. History digests reference the original unmodified lock; they do not attest historical actions. Preserve guards, locked authority and verification budgets.
20
20
 
21
+ For supported connections, inspect `sdd_list_features` with `view="setup_diagnostics"` and an optional fixed `host`; server registration, installed file hashes and client-reported identity do not prove the host-effective catalogue. Reload the client catalogue only when needed. For a locked task use `execution_window`, follow its `execution_detail` cursors and `evidence_history` pages; reread the window when a cursor is stale. These views are non-certifying. Explicitly record an already observed attempt with `sdd_lock_spec(operation="evidence_checkpoint")` only after inspecting the selected connection’s advertised input schema for `operation`, `checkpoint` and `task_id` and confirming a supporting engine version. The global 8.5.1 server does not gain new inputs from source edits: never probe an unknown mutation, or fall back to lock/relock, because old schemas may strip fields and seal instead. Report unsupported capability. The journal retains only explicitly recorded observations; failures are not recorded automatically. Its caller-reported outcome is not certification; the server captures identity and eligible digests. Preserve uncertain guards for operator review.
22
+
23
+ Before attempting completion, request a fresh explicit `verification_preflight` or `resume` and require `budget.version=1`; absence is unavailable, never a grant. An older producer may omit it. The observation is advisory, not a reservation or grant. `execution_window` and `execution_detail` are not decorated with budget and cannot substitute for that fresh request. When a verification process actually ran, its `verificationProcess` reports the effective timeout, outcome and owned process group cleanup; `fixturePostconditions` remains `unknown`. Group cleanup alone does not prove fixture safety. These diagnostics do not record attempts automatically or authorize policy changes, retries or extra time. Reconcile uncertain state before acting.
24
+
21
25
  ## Delegation
22
26
 
23
27
  Delegate useful independent work within the active TASK through available native agents; keep trivial/dependent work sequential. Load the bounded protocol from `spec-executor.md` on demand; use `spec-architect.md` for workstream routing and `verification-auditor.md` for provenance checks. The parent alone applies canonical patches and certifies. Preserve all nine tools, lock, File Manifest, limits and protected-root controls; host capabilities grant no extra authority.
@@ -50,6 +50,10 @@ Preflight never edits product files and never marks tasks complete.
50
50
  - If `planu/specs/` exists, treat it as dead. Do not list, stub, thin, or copy FEAT contracts into `SPEC-*`.
51
51
  - Host hooks that require `planu/specs/SPEC-*/spec.md` must be removed or rewritten to ignore that path. Duplicating specs is forbidden.
52
52
 
53
+ ## Connection and read-only views
54
+
55
+ For supported connections, inspect `sdd_list_features` with `view="setup_diagnostics"` and an optional fixed `host`; server registration, installed file hashes and client-reported identity do not prove the host-effective catalogue. Reload the client catalogue only when needed. For a locked task use `execution_window`, follow its `execution_detail` cursors and `evidence_history` pages; reread the window when a cursor is stale. These views are non-certifying. Explicitly record an already observed attempt with `sdd_lock_spec(operation="evidence_checkpoint")` only after inspecting the selected connection’s advertised input schema for `operation`, `checkpoint` and `task_id` and confirming a supporting engine version. The global 8.5.1 server does not gain new inputs from source edits: never probe an unknown mutation, or fall back to lock/relock, because old schemas may strip fields and seal instead. Report unsupported capability. The journal retains only explicitly recorded observations; failures are not recorded automatically. Its caller-reported outcome is not certification; the server captures identity and eligible digests. Preserve uncertain guards for operator review.
56
+
53
57
  ## Outcome
54
58
 
55
59
  Return exactly one readiness result:
@@ -8,6 +8,12 @@ role: Spec Drift Reconciler
8
8
  You act as the Spec Drift Reconciler.
9
9
  Your objective is to safely adapt `plan.md` and `tasks.md` when business requirements change midway in `spec.md`.
10
10
 
11
+ ## Evidence and contract changes
12
+
13
+ Display evidence separately: optional smoke is caller-reported and never gate coverage; each required gate needs a valid matching PASS receipt; missing evidence, skipped/partial observations or unavailable inputs are pending; challenge mismatches (workspace, feature, task, lock, candidate, observed input, procedure or environment) and signature, shape or coverage failures are stale/rejected. Receipt v1 has no TTL. Even valid receipts require fresh integration; `ready_to_attempt` permits an attempt only. Obtain signed receipts from the operator-controlled issuer. Do not grant budgets, edit authority or treat the journal as a certificate.
14
+
15
+ Compare only available captured contract, candidate and observed digests. Missing baselines and path differences are unavailable, not unchanged. Preserve recorded failures and uncertain guards; do not infer approval or historical bytes. Read the supported execution window and detail before proposing a reviewed change.
16
+
11
17
  ## RULES FOR RECONCILIATION
12
18
 
13
19
  1. **Impact Analysis:**
@@ -50,6 +50,50 @@ Your objective is to specify the smallest useful increment with deterministic, u
50
50
  Verification: <executable test command>
51
51
  ```
52
52
 
53
+ ## Illustrative Verification Receipts v1 policy
54
+
55
+ The following is a copyable shape, not a lock-ready policy or a trusted issuer. Replace every placeholder with the operator's actual public key, measured digests, reviewed paths and task IDs. The operator controls signing keys and verification budgets; agents must not generate trusted keys or grant themselves time. The `publicKey` is an Ed25519 SPKI DER public key encoded as canonical unpadded base64url, at most 128 characters. Preserve user approval of the complete trinity before lock. In plan.md encode the JSON exactly as JSON.stringify(policy, null, 2):
56
+
57
+ ````markdown
58
+ ## Verification Receipts v1
59
+ ```json
60
+ {
61
+ "publicKey": "OPERATOR_PUBLIC_KEY",
62
+ "tasks": [
63
+ {
64
+ "taskId": "TASK-1",
65
+ "gates": [
66
+ {
67
+ "id": "gate-1",
68
+ "procedureSha256": "MEASURED_PROCEDURE_SHA256",
69
+ "environmentSha256": "MEASURED_ENVIRONMENT_SHA256"
70
+ }
71
+ ],
72
+ "observed": [
73
+ "path/to/observed-input"
74
+ ],
75
+ "observedBaselineSha256": "MEASURED_OBSERVED_BASELINE_SHA256"
76
+ }
77
+ ],
78
+ "candidateCreates": [
79
+ {
80
+ "path": "path/to/created-candidate",
81
+ "requiredFromTaskId": "TASK-1"
82
+ }
83
+ ]
84
+ }
85
+ ```
86
+ ````
87
+
88
+ In tasks.md each opted-in task uses exactly one literal directive with its executable integration command:
89
+
90
+ ```markdown
91
+ - [ ] TASK-1: Describe the work
92
+ Verification (receipts v1): node verification.mjs
93
+ ```
94
+
95
+ Match the policy to actual manifest and task authority; receipt v1 permits at most 64 exact candidate writes. Never invent authority, expand limits, or treat placeholders as valid evidence.
96
+
53
97
  ## SELECT THE INCREMENT BEFORE STRUCTURE
54
98
 
55
99
  - Name one smallest useful user outcome and its observable demonstration. Defer independent requested outcomes explicitly; use the existing backlog or source rather than creating a second planning system.
@@ -33,6 +33,12 @@ You do not make architectural decisions, you do not add dependencies, and you do
33
33
  - Repeat from step 1 until `allCompleted` is true.
34
34
  - Then adopt `git-janitor.md`.
35
35
 
36
+ ## Evidence and current connection
37
+
38
+ For supported connections, inspect `sdd_list_features` with `view="setup_diagnostics"` and an optional fixed `host`; server registration, installed file hashes and client-reported identity do not prove the host-effective catalogue. Reload the client catalogue only when needed. For a locked task use `execution_window`, follow its `execution_detail` cursors and `evidence_history` pages; reread the window when a cursor is stale. These views are non-certifying. Explicitly record an already observed attempt with `sdd_lock_spec(operation="evidence_checkpoint")` only after inspecting the selected connection’s advertised input schema for `operation`, `checkpoint` and `task_id` and confirming a supporting engine version. The global 8.5.1 server does not gain new inputs from source edits: never probe an unknown mutation, or fall back to lock/relock, because old schemas may strip fields and seal instead. Report unsupported capability. The journal retains only explicitly recorded observations; failures are not recorded automatically. Its caller-reported outcome is not certification; the server captures identity and eligible digests. Preserve uncertain guards for operator review.
39
+
40
+ Display evidence separately: optional smoke is caller-reported and never gate coverage; each required gate needs a valid matching PASS receipt; missing evidence, skipped/partial observations or unavailable inputs are pending; challenge mismatches (workspace, feature, task, lock, candidate, observed input, procedure or environment) and signature, shape or coverage failures are stale/rejected. Receipt v1 has no TTL. Even valid receipts require fresh integration; `ready_to_attempt` permits an attempt only. Obtain signed receipts from the operator-controlled issuer. Do not grant budgets, edit authority or treat the journal as a certificate.
41
+
36
42
  ## Small steps and early feedback
37
43
 
38
44
  - Tie the active task to the selected user outcome. Make the smallest change needed for its current acceptance behavior, reusing existing contracts and components; do not add layers for hypothetical future work.
@@ -52,6 +52,12 @@ For every acceptance criterion, record:
52
52
 
53
53
  Count-only assertions, existence checks, snapshots without semantics, and tests that pass before the change do not prove behavior.
54
54
 
55
+ ## Evidence provenance
56
+
57
+ Display evidence separately: optional smoke is caller-reported and never gate coverage; each required gate needs a valid matching PASS receipt; missing evidence, skipped/partial observations or unavailable inputs are pending; challenge mismatches (workspace, feature, task, lock, candidate, observed input, procedure or environment) and signature, shape or coverage failures are stale/rejected. Receipt v1 has no TTL. Even valid receipts require fresh integration; `ready_to_attempt` permits an attempt only. Obtain signed receipts from the operator-controlled issuer. Do not grant budgets, edit authority or treat the journal as a certificate.
58
+
59
+ Verify explicitly recorded failure and later records independently in chronological history; no unrecorded failure is implied. Distinguish caller-reported observations from server-captured identity and eligible digests. Read execution window, detail and evidence history on a connection that actually supports them; do not probe an unknown mutation. A checkpoint does not certify a task.
60
+
55
61
  ## Test-integrity review
56
62
 
57
63
  - Compare before and after test code against the actual acceptance behavior, not only the final runner status.
@@ -1,3 +0,0 @@
1
- import type { SddResult, ToolResult } from '../../types/sdd-engine.js';
2
- export declare function formatResult<T>(result: SddResult<T>): ToolResult;
3
- //# sourceMappingURL=format-result.d.ts.map
@@ -1,22 +0,0 @@
1
- export function formatResult(result) {
2
- if (!result.success) {
3
- return {
4
- content: [
5
- {
6
- type: 'text',
7
- text: JSON.stringify(result, null, 2),
8
- },
9
- ],
10
- isError: true,
11
- };
12
- }
13
- return {
14
- content: [
15
- {
16
- type: 'text',
17
- text: JSON.stringify(result, null, 2),
18
- },
19
- ],
20
- };
21
- }
22
- //# sourceMappingURL=format-result.js.map