@davidorex/pi-context 0.32.0 → 0.33.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/CHANGELOG.md +15 -0
- package/README.md +4 -3
- package/dist/block-api.d.ts +20 -33
- package/dist/block-api.d.ts.map +1 -1
- package/dist/block-api.js +127 -1
- package/dist/block-api.js.map +1 -1
- package/dist/content-hash.d.ts +9 -0
- package/dist/content-hash.d.ts.map +1 -1
- package/dist/content-hash.js +11 -0
- package/dist/content-hash.js.map +1 -1
- package/dist/context-sdk.d.ts +88 -8
- package/dist/context-sdk.d.ts.map +1 -1
- package/dist/context-sdk.js +363 -116
- package/dist/context-sdk.js.map +1 -1
- package/dist/context.d.ts +5 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +185 -3
- package/dist/index.js.map +1 -1
- package/dist/ops-registry.d.ts +18 -0
- package/dist/ops-registry.d.ts.map +1 -1
- package/dist/ops-registry.js +388 -17
- package/dist/ops-registry.js.map +1 -1
- package/package.json +2 -2
- package/samples/conception.json +7 -0
- package/samples/schemas/framework-gaps.schema.json +5 -0
- package/samples/schemas/research.schema.json +41 -2
- package/schemas/config.schema.json +13 -1
- package/skill-narrative.md +1 -1
- package/skills/pi-context/SKILL.md +30 -18
|
@@ -10,9 +10,9 @@ description: >
|
|
|
10
10
|
|
|
11
11
|
<tools_reference>
|
|
12
12
|
<tool name="append-block-item">
|
|
13
|
-
Append an item to an array in a project block file. Schema validation is automatic. Set autoId:true to allocate the next id from the block's id pattern when the item has no id.
|
|
13
|
+
Append an item to an array in a project block file. Schema validation is automatic. Set autoId:true to allocate the next id from the block's id pattern when the item has no id. Optional relations file the item's BIRTH edges in the same op run, after id allocation — each entry names the relation_type, the other endpoint's selector, and EXACTLY ONE orientation: direction (as_parent | as_child — the raw endpoint the new item occupies) or role (primary | counter — the semantic role the new item holds, mapped via the relation's declared role_direction; required for role-bearing orientation-ambiguous relation_types such as the gated-by / derived-from / supersedes / depends families, where the raw form is rejected). Filing item + edges as one atom lets a new item satisfy error-severity birth-edge invariants (e.g. a decision must cite a forcing artifact) that would refuse the bare item under the write-time gate. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
14
14
|
|
|
15
|
-
*Append items to project blocks (issues, decisions, or any user-defined block)*
|
|
15
|
+
*Append items to project blocks (issues, decisions, or any user-defined block), with optional atomic birth edges*
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Required | Description |
|
|
18
18
|
|-----------|------|----------|-------------|
|
|
@@ -20,10 +20,11 @@ Append an item to an array in a project block file. Schema validation is automat
|
|
|
20
20
|
| `arrayKey` | string | yes | Array key in the block (e.g., 'issues', 'decisions') |
|
|
21
21
|
| `item` | unknown | yes | Item object to append — must conform to block schema |
|
|
22
22
|
| `autoId` | boolean | no | When true and the item has no id, allocate the next id from the block's id pattern |
|
|
23
|
+
| `relations` | array | no | Birth edges filed atomically with the item, after id allocation, via the same validated append-relation porcelain (each entry oriented by direction OR role) |
|
|
23
24
|
</tool>
|
|
24
25
|
|
|
25
26
|
<tool name="update-block-item">
|
|
26
|
-
Update fields on an item in a project block array. Finds by predicate field match.
|
|
27
|
+
Update fields on an item in a project block array. Finds by predicate field match. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
27
28
|
|
|
28
29
|
*Update items in project blocks — change status, add details, mark resolved*
|
|
29
30
|
|
|
@@ -36,7 +37,7 @@ Update fields on an item in a project block array. Finds by predicate field matc
|
|
|
36
37
|
</tool>
|
|
37
38
|
|
|
38
39
|
<tool name="append-relation">
|
|
39
|
-
Append a closure-table relation (edge: relation_type, optional ordinal) to relations.json. Orient the edge with EITHER raw --parent/--child OR the role-typed --primary/--counter (which maps to parent/child via the relation's declared role_direction); the two pairs are mutually exclusive. A bare --parent/--child append of a relation that is BOTH role-bearing and orientation-ambiguous (its source/target kinds overlap) is rejected — re-issue with --primary/--counter. Shape is AJV-validated; an exact-duplicate edge (same parent+child+relation_type) is a no-op. Reference integrity (endpoints resolve, relation_type registered, no cycle) is NOT checked here — run context-validate after. Creates relations.json if absent.
|
|
40
|
+
Append a closure-table relation (edge: relation_type, optional ordinal) to relations.json. Orient the edge with EITHER raw --parent/--child OR the role-typed --primary/--counter (which maps to parent/child via the relation's declared role_direction); the two pairs are mutually exclusive. A bare --parent/--child append of a relation that is BOTH role-bearing and orientation-ambiguous (its source/target kinds overlap) is rejected — re-issue with --primary/--counter. Shape is AJV-validated; an exact-duplicate edge (same parent+child+relation_type) is a no-op. Reference integrity (endpoints resolve, relation_type registered, no cycle) is NOT checked here — run context-validate after. Creates relations.json if absent. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
40
41
|
|
|
41
42
|
*Create a relation/edge between two items (raw --parent/--child, or role-typed --primary/--counter mapped via role_direction)*
|
|
42
43
|
|
|
@@ -52,7 +53,7 @@ Append a closure-table relation (edge: relation_type, optional ordinal) to relat
|
|
|
52
53
|
</tool>
|
|
53
54
|
|
|
54
55
|
<tool name="remove-relation">
|
|
55
|
-
Remove the single closure-table relation (edge) matching parent+child+relation_type from relations.json. Matches on the SAME (parent, child, relation_type) dedup identity append-relation uses, so it is the symmetric inverse of append-relation (ordinal is NOT part of identity). An absent edge is an idempotent no-op. Reference integrity is NOT checked here — run context-validate after if the removal changes resolvability.
|
|
56
|
+
Remove the single closure-table relation (edge) matching parent+child+relation_type from relations.json. Matches on the SAME (parent, child, relation_type) dedup identity append-relation uses, so it is the symmetric inverse of append-relation (ordinal is NOT part of identity). An absent edge is an idempotent no-op. Reference integrity is NOT checked here — run context-validate after if the removal changes resolvability. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
56
57
|
|
|
57
58
|
*Remove a relation/edge between two items (the inverse of append-relation)*
|
|
58
59
|
|
|
@@ -65,7 +66,7 @@ Remove the single closure-table relation (edge) matching parent+child+relation_t
|
|
|
65
66
|
</tool>
|
|
66
67
|
|
|
67
68
|
<tool name="replace-relation">
|
|
68
|
-
Atomically replace one closure-table relation with another in a SINGLE write (no half-state: the old edge and the new edge never coexist on disk). The old edge is matched on the (parent, child, relation_type) dedup identity; the new edge is written with its optional ordinal. If the old edge is absent the call is effectively an append of the new edge. This op takes RAW parent/child (old + new) and BYPASSES the write-time orientation gate that append-relation applies — it writes the endpoints verbatim, so it is the affordance for re-orienting an existing edge; reference integrity is NOT checked here — run context-validate after.
|
|
69
|
+
Atomically replace one closure-table relation with another in a SINGLE write (no half-state: the old edge and the new edge never coexist on disk). The old edge is matched on the (parent, child, relation_type) dedup identity; the new edge is written with its optional ordinal. If the old edge is absent the call is effectively an append of the new edge. This op takes RAW parent/child (old + new) and BYPASSES the write-time orientation gate that append-relation applies — it writes the endpoints verbatim, so it is the affordance for re-orienting an existing edge; reference integrity is NOT checked here — run context-validate after. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
69
70
|
|
|
70
71
|
*Atomically swap one relation/edge for another in a single write*
|
|
71
72
|
|
|
@@ -82,7 +83,7 @@ Atomically replace one closure-table relation with another in a SINGLE write (no
|
|
|
82
83
|
</tool>
|
|
83
84
|
|
|
84
85
|
<tool name="append-relations">
|
|
85
|
-
Append MANY closure-table relations to relations.json in a single write. Each edge is an object with { relation_type, ordinal? } plus EITHER a raw { parent, child } pair OR the role-typed { primary, counter } pair (mapped to parent/child via the relation's declared role_direction); the two pairs are mutually exclusive per edge, and a bare { parent, child } for an orientation-ambiguous role-bearing relation rejects the whole batch before any write. Per-(parent, child, relation_type) duplicates are skipped (against on-disk edges AND earlier edges in the same batch). Returns appended/skipped counts. Reference integrity is NOT checked here — run context-validate after. Creates relations.json if absent.
|
|
86
|
+
Append MANY closure-table relations to relations.json in a single write. Each edge is an object with { relation_type, ordinal? } plus EITHER a raw { parent, child } pair OR the role-typed { primary, counter } pair (mapped to parent/child via the relation's declared role_direction); the two pairs are mutually exclusive per edge, and a bare { parent, child } for an orientation-ambiguous role-bearing relation rejects the whole batch before any write. Per-(parent, child, relation_type) duplicates are skipped (against on-disk edges AND earlier edges in the same batch). Returns appended/skipped counts. Reference integrity is NOT checked here — run context-validate after. Creates relations.json if absent. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
86
87
|
|
|
87
88
|
*Create many relations/edges between items in one write (raw or role-typed per edge)*
|
|
88
89
|
|
|
@@ -93,9 +94,9 @@ Append MANY closure-table relations to relations.json in a single write. Each ed
|
|
|
93
94
|
</tool>
|
|
94
95
|
|
|
95
96
|
<tool name="upsert-block-item">
|
|
96
|
-
Append-or-replace an item in a project block array by id: if an item with the same idField value exists it is REPLACED (full-shape replacement, not shallow-merge — use update-block-item for merge); otherwise the item is appended. Schema validation is automatic. idField defaults to 'id'.
|
|
97
|
+
Append-or-replace an item in a project block array by id: if an item with the same idField value exists it is REPLACED (full-shape replacement, not shallow-merge — use update-block-item for merge); otherwise the item is appended. Schema validation is automatic. idField defaults to 'id'. Optional relations file BIRTH edges in the same op run when the upsert resolves to an APPEND — each entry names the relation_type, the other endpoint's selector, and EXACTLY ONE orientation: direction (as_parent | as_child, raw) or role (primary | counter, mapped via the relation's declared role_direction; required for role-bearing orientation-ambiguous relation_types) — one atom under the write-time gate, so a new filing can satisfy error-severity birth-edge invariants. dryRun previews the upsert AND runs the same orientation guard over the entries (a preview refuses what the live run would orientation-refuse; endpoint resolution stays out — the item is unwritten). When the upsert resolves to a REPLACE, supplying relations refuses the write (birth edges are for new items; file edges on an existing item via append-relation). Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
97
98
|
|
|
98
|
-
*Append-or-replace a full block item by id (replacement, not merge)*
|
|
99
|
+
*Append-or-replace a full block item by id (replacement, not merge), with optional atomic birth edges*
|
|
99
100
|
|
|
100
101
|
| Parameter | Type | Required | Description |
|
|
101
102
|
|-----------|------|----------|-------------|
|
|
@@ -104,10 +105,11 @@ Append-or-replace an item in a project block array by id: if an item with the sa
|
|
|
104
105
|
| `item` | unknown | yes | Full item object to upsert — must conform to block schema |
|
|
105
106
|
| `idField` | string | no | Field used as the upsert key (default 'id') |
|
|
106
107
|
| `dryRun` | boolean | no | Preview the upsert without writing |
|
|
108
|
+
| `relations` | array | no | Birth edges filed atomically with an APPEND-mode upsert, each entry oriented by direction OR role (refused on replace mode — use append-relation for existing items) |
|
|
107
109
|
</tool>
|
|
108
110
|
|
|
109
111
|
<tool name="promote-item">
|
|
110
|
-
Promote a substrate item into another (registered) substrate as a NEW content-addressed item, recording the 'item_derived_from_item' lineage edge in the destination relations.json (parent = the new derived item, child = the source, carrying the source content_hash). The destination write-path mints a fresh oid + content_hash + content object. When the source block's status enum supports it, the source is marked superseded. Preconditions (unresolvable/non-item source, unregistered destination alias, unregistered destination relation_type, refname collision) throw. Pass dryRun to compute the destination without writing.
|
|
112
|
+
Promote a substrate item into another (registered) substrate as a NEW content-addressed item, recording the 'item_derived_from_item' lineage edge in the destination relations.json (parent = the new derived item, child = the source, carrying the source content_hash). The destination write-path mints a fresh oid + content_hash + content object. When the source block's status enum supports it, the source is marked superseded. Preconditions (unresolvable/non-item source, unregistered destination alias, unregistered destination relation_type, refname collision) throw. Pass dryRun to compute the destination without writing. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
111
113
|
|
|
112
114
|
*Promote an item into another substrate as a derived copy with a lineage edge*
|
|
113
115
|
|
|
@@ -150,7 +152,7 @@ Update fields on a nested-array item inside a parent-array item in a project blo
|
|
|
150
152
|
</tool>
|
|
151
153
|
|
|
152
154
|
<tool name="remove-block-item">
|
|
153
|
-
Remove items matching a predicate from a top-level array in a project block. Idempotent — returns { removed: 0 } on no match without throwing. Schema validation runs after removal.
|
|
155
|
+
Remove items matching a predicate from a top-level array in a project block. Idempotent — returns { removed: 0 } on no match without throwing. Schema validation runs after removal. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
154
156
|
|
|
155
157
|
*Remove items from project blocks — prune retracted issues, dedupe entries*
|
|
156
158
|
|
|
@@ -196,7 +198,7 @@ Read a project block file as structured JSON.
|
|
|
196
198
|
</tool>
|
|
197
199
|
|
|
198
200
|
<tool name="write-block">
|
|
199
|
-
Write or replace an entire project block with schema validation.
|
|
201
|
+
Write or replace an entire project block with schema validation. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
200
202
|
|
|
201
203
|
*Write or replace a project block with schema validation*
|
|
202
204
|
|
|
@@ -269,7 +271,7 @@ Fetch and print the verbatim catalog schema body (raw JSON Schema: properties/de
|
|
|
269
271
|
</tool>
|
|
270
272
|
|
|
271
273
|
<tool name="context-current-state">
|
|
272
|
-
Derive 'where are we + what's next' purely from the substrate — focus, in-flight items, ranked atomic-next actions, blocked items, and milestone rollups. Every facet derives from the config-declared `state_derivation` registry: which block kinds + status bucket count as in-flight, the focus fallback kind + bucket, the ordered cross-kind next-actions push order with per-entry ranking (a named field + ordered value list, e.g. gap priority P0..P3) or topo ordering over the blocking-relation graph, the relation_types whose edges contribute blockers (the stock set being `task_depends_on_task` dependencies + `task_gated_by_item` gates), the membership rollups (e.g. milestones over `phase_positioned_in_milestone`) with their complete/incomplete status strings, and the next-actions head-size cap. A blocked item's dependency/gate target that
|
|
274
|
+
Derive 'where are we + what's next' purely from the substrate — focus, in-flight items, ranked atomic-next actions, blocked items, and milestone rollups. Every facet derives from the config-declared `state_derivation` registry: which block kinds + status bucket count as in-flight, the focus fallback kind + bucket, the ordered cross-kind next-actions push order with per-entry ranking (a named field + ordered value list, e.g. gap priority P0..P3) or topo ordering over the blocking-relation graph, the relation_types whose edges contribute blockers (the stock set being `task_depends_on_task` dependencies + `task_gated_by_item` gates), the membership rollups (e.g. milestones over `phase_positioned_in_milestone`) with their complete/incomplete status strings, and the next-actions head-size cap. A blocked item's dependency/gate target that is not complete is reported in blockedBy and held out of nextActions; completeness follows the target kind's truth model — a rollup-declared kind (state_derivation.rollups, e.g. milestone) completes by its DERIVED membership rollup, the same verdict the milestones facet reports, so one read never self-contradicts and a derived-status kind's stored status field is never consulted; every other kind completes by its status bucketing to complete. A substrate whose config declares no `state_derivation` reports focus 'state-derivation not configured' with empty arrays. No writes; nothing hand-stored.
|
|
273
275
|
|
|
274
276
|
*Derive current project state from the config-declared state_derivation registry — focus, in-flight, ranked next actions, blocked, milestone rollups*
|
|
275
277
|
|
|
@@ -283,7 +285,7 @@ Derive the substrate bootstrap state for the cwd, purely from the filesystem: 'n
|
|
|
283
285
|
</tool>
|
|
284
286
|
|
|
285
287
|
<tool name="rename-canonical-id">
|
|
286
|
-
Rename a canonical_id (kind: item | relation_type | lens | layer) from oldId to newId across all substrate surfaces that carry it as DATA — item home block + relations.json edges, or the relevant config registries. Out-of-substrate occurrences (analysis MDs, git history) are REPORTED, never rewritten. block_kind renames are unsupported (filesystem cascade). Use dryRun to preview the would-change counts without writing.
|
|
288
|
+
Rename a canonical_id (kind: item | relation_type | lens | layer) from oldId to newId across all substrate surfaces that carry it as DATA — item home block + relations.json edges, or the relevant config registries. Out-of-substrate occurrences (analysis MDs, git history) are REPORTED, never rewritten. block_kind renames are unsupported (filesystem cascade). Use dryRun to preview the would-change counts without writing. Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
287
289
|
|
|
288
290
|
*Rename a canonical_id (item/relation_type/lens/layer) across substrate; dryRun to preview*
|
|
289
291
|
|
|
@@ -407,6 +409,16 @@ Bring the installed substrate model (schemas) current with the packaged catalog.
|
|
|
407
409
|
| `dryRun` | boolean | no | Preview the per-schema action plan without writing anything. |
|
|
408
410
|
</tool>
|
|
409
411
|
|
|
412
|
+
<tool name="context-reconcile">
|
|
413
|
+
Converge stored substrate state with its derivation (the repair half of the derived-status invariant class). For every block kind a derived-status invariant declares (paired with its state_derivation.rollups entry), computes each item's stored-vs-derived status delta using the SAME completeness helper the state derivation's gate satisfaction and context-validate use — the preview, the detector, and the repair cannot disagree. The sweep also includes declared-baseline STALENESS: every stale_conditions-bearing item whose status buckets complete and whose typed condition fired (item-status / file-changed / revision-moved) or whose citation content pin drifted transitions to stale — the same evaluateStalenessCandidates verdict context-validate flags with; flag-only anchor-drift items never transition. --dryRun returns the exact delta + transition sets a live run would apply (deltas: id, block, from stored value, to derived value, declaring invariant; stalenessTransitions: id, block, from, to stale, firing reasons), writing nothing. A live run applies exactly those sets through the standard validated write path — identity-stamped, envelope-stamped, attested to the invoking writer — and reports the applied counts; a converge-write is not authoring, the written value IS the derivation, and the stale transition applies a condition the item itself declared. Scope: derived-status deltas + declared-staleness transitions ONLY — the op never writes an authored-status kind (feature/gap/issue/task buckets are human judgment) and never touches prose; those classes are flagged for review by context-validate, not auto-repaired. Ceremony discipline: seeds the catalog config migration declarations at entry, and a live run on a substrate with no substrate_id establishes the identity first (reported under substrateIdEstablished). A converged substrate is a clean no-op both ways.
|
|
414
|
+
|
|
415
|
+
*Converge stored rollup-kind statuses with their derivation and apply declared complete-to-stale transitions (--dryRun previews the exact sets; live applies through the validated write path; never touches authored statuses or prose)*
|
|
416
|
+
|
|
417
|
+
| Parameter | Type | Required | Description |
|
|
418
|
+
|-----------|------|----------|-------------|
|
|
419
|
+
| `dryRun` | boolean | no | Preview the exact delta set without writing anything. |
|
|
420
|
+
</tool>
|
|
421
|
+
|
|
410
422
|
<tool name="validate-block-items">
|
|
411
423
|
Validate a block's items against the catalog schema version — returns the per-item failures (item id, field, constraint) without writing. Resolves the block's catalog block_kind, loads the installed block, forward-migrates its items in memory through the shipped chain when the block lags the catalog version (a fresh registry; never warms the project's cache), and validates against the catalog schema body. Returns block / from (the block's declared version) / to (the catalog version) / valid / failures[] (each: itemId — the failing item's id when the instancePath resolves to one — instancePath, keyword, message). Read-only: never overwrites the schema, the block, or migrations.json. An unknown block or a missing installed block file throws.
|
|
412
424
|
|
|
@@ -522,14 +534,14 @@ Bulk variant of resolve-item-by-id — resolve N kind-prefixed ids against a sin
|
|
|
522
534
|
</tool>
|
|
523
535
|
|
|
524
536
|
<tool name="complete-task">
|
|
525
|
-
Complete a task with verification gate —
|
|
537
|
+
Complete a task with verification gate — the closure ATOM. Requires a passing verification entry, then FILES the verification_verifies_item edge itself (idempotent — a pre-existing exact edge is a no-op) and flips the task status to completed in one op run, so the write-time invariant gate judges the joint end-state. No prior append-relation step is needed (a standalone edge or status write would be refused by error-severity closure invariants; this op IS the legal transition). Write pipeline: after this op's write, rollup-kind stored statuses converge with their derivation, and the config invariants are re-evaluated delta-scoped — a violation newly introduced by this write refuses it at error severity (substrate byte-restored) or is surfaced on the result at warning severity (write-warning lines / writeWarnings); pre-existing violations never block.
|
|
526
538
|
|
|
527
|
-
*Complete a task — gates on passing verification
|
|
539
|
+
*Complete a task — gates on passing verification, files the verification edge itself, then flips status (one atom)*
|
|
528
540
|
|
|
529
541
|
| Parameter | Type | Required | Description |
|
|
530
542
|
|-----------|------|----------|-------------|
|
|
531
543
|
| `taskId` | string | yes | Task ID to complete |
|
|
532
|
-
| `verificationId` | string | yes | Verification entry ID (must
|
|
544
|
+
| `verificationId` | string | yes | Verification entry ID (must have status 'passed'; the op files the linking edge itself) |
|
|
533
545
|
</tool>
|
|
534
546
|
|
|
535
547
|
<tool name="context-validate-relations">
|
|
@@ -797,7 +809,7 @@ The installable catalog IS the packaged conception (`samples/conception.json`):
|
|
|
797
809
|
<substrate_config>
|
|
798
810
|
`<substrate-dir>/config.json` is the substrate bootstrap. Its `root` field declares where every other block, schema, agent, and template lives — consumers resolve that dir via the `.pi-context.json` pointer plus `config.root`, never by assuming a fixed directory name. Its `substrate_id` field is the per-substrate root identity (pattern `sub-` followed by 16 hex), minted once and immutable on disk; it salts oid minting and identifies the substrate in the project-root registry. `naming` aliases canonical block ids to display names (used by `/context view` rendering). `hierarchy` declares legal closure-table edges (parent block → child block via relation_type). `lenses` declares named projections over a target block. `installed_schemas` / `installed_blocks` are the install manifest consumed by `/context install`. `installed_from` is the optional install baseline `/context install` records — the catalog source plus a per-schema content fingerprint of the installed schemas — for installed-vs-catalog drift detection.
|
|
799
811
|
|
|
800
|
-
A fresh substrate adopted via `/context accept-all` carries advisory (severity-`warning`) convention-articulation invariants: every decision, feature, and task should carry an `item_governed_by_convention` edge to a convention it follows, or an `item_acknowledges_missing_convention` edge to a missing-convention gap. `context-validate` reports an artifact that articulates neither as a warning (it does not error), so the advice surfaces without blocking writes; satisfy it by
|
|
812
|
+
A fresh substrate adopted via `/context accept-all` carries advisory (severity-`warning`) convention-articulation invariants: every decision, feature, and task should carry an `item_governed_by_convention` edge to a convention it follows, or an `item_acknowledges_missing_convention` edge to a missing-convention gap. `context-validate` reports an artifact that articulates neither as a warning (it does not error), so the advice surfaces without blocking writes; satisfy it by filing one of those two edges as a birth relation on the filing itself (`append-block-item --relations`; each entry oriented by `direction: as_parent|as_child` for raw appends, or `role: primary|counter` for role-bearing orientation-ambiguous relation_types such as the gated-by / derived-from / supersedes / depends families, mapped via the relation's declared `role_direction`) or by `append-relation` when amending an existing artifact. On a substrate that raises a birth-edge invariant to `error`, the atomic filing form is the only path the write-time gate accepts — a bare filing is refused, and the edge cannot be added afterward because the intermediate state is itself the violation. Task closure has the same shape: `complete-task` files the `verification_verifies_item` edge itself and flips the task status in one gate-judged run, so no standalone `append-relation` precedes it.
|
|
801
813
|
|
|
802
814
|
`config.json` and `relations.json` are exempt from `config.root` redirection — they always live at the substrate-dir root (the dir chosen at bootstrap, resolved via the `.pi-context.json` pointer, suggested `.context`) because they are the substrate that defines `root`. The substrate-dir root is whatever was chosen at bootstrap, not necessarily `.project`. All other state lives under `<config.root>/...` per `resolveContextDir(cwd)`. The package ships their schemas in `schemas/` (config.schema.json, relations.schema.json) and resolves them via three-tier search: project override > user override > package-shipped.
|
|
803
815
|
|