@davidorex/pi-context 0.26.0 → 0.28.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 (123) hide show
  1. package/CHANGELOG.md +69 -15
  2. package/README.md +71 -18
  3. package/dist/block-api.d.ts +165 -18
  4. package/dist/block-api.d.ts.map +1 -1
  5. package/dist/block-api.js +800 -57
  6. package/dist/block-api.js.map +1 -1
  7. package/dist/citation-rot-scanner.d.ts +80 -0
  8. package/dist/citation-rot-scanner.d.ts.map +1 -0
  9. package/dist/citation-rot-scanner.js +421 -0
  10. package/dist/citation-rot-scanner.js.map +1 -0
  11. package/dist/content-hash.d.ts +25 -0
  12. package/dist/content-hash.d.ts.map +1 -0
  13. package/dist/content-hash.js +62 -0
  14. package/dist/content-hash.js.map +1 -0
  15. package/dist/context-dir.d.ts +126 -1
  16. package/dist/context-dir.d.ts.map +1 -1
  17. package/dist/context-dir.js +208 -4
  18. package/dist/context-dir.js.map +1 -1
  19. package/dist/context-registry.d.ts +122 -0
  20. package/dist/context-registry.d.ts.map +1 -0
  21. package/dist/context-registry.js +189 -0
  22. package/dist/context-registry.js.map +1 -0
  23. package/dist/context-sdk.d.ts +179 -12
  24. package/dist/context-sdk.d.ts.map +1 -1
  25. package/dist/context-sdk.js +536 -101
  26. package/dist/context-sdk.js.map +1 -1
  27. package/dist/context.d.ts +222 -4
  28. package/dist/context.d.ts.map +1 -1
  29. package/dist/context.js +244 -56
  30. package/dist/context.js.map +1 -1
  31. package/dist/git-env.d.ts +2 -0
  32. package/dist/git-env.d.ts.map +1 -0
  33. package/dist/git-env.js +29 -0
  34. package/dist/git-env.js.map +1 -0
  35. package/dist/index.d.ts +124 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +440 -1125
  38. package/dist/index.js.map +1 -1
  39. package/dist/lens-view.d.ts.map +1 -1
  40. package/dist/lens-view.js +5 -3
  41. package/dist/lens-view.js.map +1 -1
  42. package/dist/migration-registry-loader.d.ts +121 -0
  43. package/dist/migration-registry-loader.d.ts.map +1 -0
  44. package/dist/migration-registry-loader.js +309 -0
  45. package/dist/migration-registry-loader.js.map +1 -0
  46. package/dist/migrations-store.d.ts +141 -0
  47. package/dist/migrations-store.d.ts.map +1 -0
  48. package/dist/migrations-store.js +206 -0
  49. package/dist/migrations-store.js.map +1 -0
  50. package/dist/object-store.d.ts +26 -0
  51. package/dist/object-store.d.ts.map +1 -0
  52. package/dist/object-store.js +104 -0
  53. package/dist/object-store.js.map +1 -0
  54. package/dist/ops-registry.d.ts +44 -0
  55. package/dist/ops-registry.d.ts.map +1 -0
  56. package/dist/ops-registry.js +1223 -0
  57. package/dist/ops-registry.js.map +1 -0
  58. package/dist/orientation.d.ts +16 -0
  59. package/dist/orientation.d.ts.map +1 -0
  60. package/dist/orientation.js +49 -0
  61. package/dist/orientation.js.map +1 -0
  62. package/dist/promote-item.d.ts +28 -0
  63. package/dist/promote-item.d.ts.map +1 -0
  64. package/dist/promote-item.js +257 -0
  65. package/dist/promote-item.js.map +1 -0
  66. package/dist/read-element.d.ts +129 -0
  67. package/dist/read-element.d.ts.map +1 -0
  68. package/dist/read-element.js +296 -0
  69. package/dist/read-element.js.map +1 -0
  70. package/dist/rename-canonical-id.d.ts.map +1 -1
  71. package/dist/rename-canonical-id.js +22 -13
  72. package/dist/rename-canonical-id.js.map +1 -1
  73. package/dist/roadmap-plan.d.ts.map +1 -1
  74. package/dist/roadmap-plan.js +23 -13
  75. package/dist/roadmap-plan.js.map +1 -1
  76. package/dist/schema-validator.d.ts +1 -0
  77. package/dist/schema-validator.d.ts.map +1 -1
  78. package/dist/schema-validator.js +7 -3
  79. package/dist/schema-validator.js.map +1 -1
  80. package/dist/schema-write.d.ts +78 -4
  81. package/dist/schema-write.d.ts.map +1 -1
  82. package/dist/schema-write.js +297 -34
  83. package/dist/schema-write.js.map +1 -1
  84. package/dist/status-vocab.d.ts +1 -0
  85. package/dist/status-vocab.d.ts.map +1 -1
  86. package/dist/status-vocab.js +4 -0
  87. package/dist/status-vocab.js.map +1 -1
  88. package/dist/truncate.d.ts +34 -0
  89. package/dist/truncate.d.ts.map +1 -0
  90. package/dist/truncate.js +85 -0
  91. package/dist/truncate.js.map +1 -0
  92. package/dist/write-schema-migration-tool.d.ts +46 -0
  93. package/dist/write-schema-migration-tool.d.ts.map +1 -0
  94. package/dist/write-schema-migration-tool.js +115 -0
  95. package/dist/write-schema-migration-tool.js.map +1 -0
  96. package/package.json +35 -2
  97. package/samples/blocks/work-orders.json +3 -0
  98. package/samples/conception.json +22 -3
  99. package/samples/migrations.json +133 -0
  100. package/samples/schemas/context-contracts.schema.json +19 -4
  101. package/samples/schemas/conventions.schema.json +68 -12
  102. package/samples/schemas/decisions.schema.json +125 -28
  103. package/samples/schemas/features.schema.json +140 -26
  104. package/samples/schemas/framework-gaps.schema.json +171 -26
  105. package/samples/schemas/issues.schema.json +86 -13
  106. package/samples/schemas/layer-plans.schema.json +195 -35
  107. package/samples/schemas/phase.schema.json +18 -3
  108. package/samples/schemas/rationale.schema.json +37 -7
  109. package/samples/schemas/requirements.schema.json +77 -10
  110. package/samples/schemas/research.schema.json +169 -36
  111. package/samples/schemas/spec-reviews.schema.json +88 -18
  112. package/samples/schemas/story.schema.json +18 -3
  113. package/samples/schemas/tasks.schema.json +66 -10
  114. package/samples/schemas/verification.schema.json +70 -12
  115. package/samples/schemas/work-orders.schema.json +195 -0
  116. package/schemas/bootstrap.schema.json +18 -6
  117. package/schemas/config.schema.json +58 -26
  118. package/schemas/context-registry.schema.json +46 -0
  119. package/schemas/migrations.schema.json +123 -0
  120. package/schemas/relations.schema.json +41 -10
  121. package/skill-narrative.md +42 -21
  122. package/skills/pi-context/SKILL.md +159 -65
  123. package/skills/pi-context/references/bundled-resources.md +7 -2
package/CHANGELOG.md CHANGED
@@ -1,23 +1,77 @@
1
1
  # Changelog
2
2
 
3
- ## [0.3.0] - 2026-03-18
3
+ All notable changes to this package are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/); the public release history is per-package (see the monorepo lockstep `package.json` version vs. what was published to npm). This package has had exactly one public npm release (`0.26.0`); the consolidated `[0.26.0]` entry below covers its full history through that publish, and `[Unreleased]` holds changes since.
4
4
 
5
- ## [0.2.0] - 2026-03-17
5
+ ## [Unreleased]
6
+
7
+ ## [0.28.0] - 2026-06-03
6
8
 
7
9
  ### Added
8
- - `/project init` command to scaffold `.project/` directory with default schemas and empty block files
9
- - Update check on session start for `@davidorex/pi-project-workflows` meta-package
10
- - Monorepo integration as workspace package
10
+ - Content-addressed substrate identity: content-hash primitives + content object store, OID minting with identity stamping, `substrate_id` core, and `migrateToContentAddressed` engine with `onlySubstrates` discovery scoping and an optional `register` flag to mint without a registry write (`62b8375`, `5d57465`, `dca378d`, `071b393`, `bf0bfc7`)
11
+ - Substrate registry with aliases, source-of-truth drift invariant, and adopt wiring; registry-fallback foreign endpoint resolution for non-discovered registered substrates (`633d154`, `87c0834`)
12
+ - `resolveRef` cross-substrate resolution with validator severity split (`06331df`)
13
+ - `promoteItem` + `item_derived_from_item` lineage edges + block-append id-uniqueness guard (`7cb1644`)
14
+ - Structured `EdgeEndpoint` model with dual-form consumers/validators (`fa91fda`)
15
+ - `/context switch` family (`switch <dir>` | `switch -c <new-dir>` | `switch -`), `/context list`, `/context archive` commands plus matching in-pi Pi tools (`context-switch`, `context-list`, `context-archive`); `flipBootstrapPointer` helper and bootstrap pointer schema bump 1.0.0 → 1.1.0 adding `previous_contextDir` / `switched_at` / `switched_by` (`ba7021b`, `bd52b61`, `4a34ef1`, `cdacdb4`)
16
+ - Schema migration registry: `migrations.schema.json` + migrations-store + loader with rename/set/delete/coerce declarative transforms; `write-schema-migration` Pi tool routed through the auth-gate; migration registry wired into `writeBlock`/`readBlock` validation paths (`22d7d24`, `18ce8d0`, `77b0f9f`, `dd85196`, `bbad988`)
17
+ - Config schema extended with `tool_operations[]` (operation-granular grant vocabulary) and `tool_operations_forbidden[]` (`4394ab6`, `4e722f0`)
18
+ - Work-orders block kind: schema, sample block, conception-catalog registration, and status-vocab mapping (`b107fad`, `26d4ceb`, `6ab7545`, `443eb65`)
19
+ - Citation-rot scanner library with AST-based detection (`e83043b`, `56113cb`)
20
+ - Orientation block + skills-dir support and `before_agent_start` / `resources_discover` guidance hooks (`bea080f`, `28dfbd0`)
21
+ - Pure read-element primitive (`serializeForRead` + `addressInto`) with element addressing; all JSON read handlers routed through it; over-cap reads fail closed via vendored `truncateHead` (`68c2873`, `bcabcb2`, `103cb29`, `cdae473`)
22
+ - Per-op `authGated` metadata on the op-registry and a derived `gatedTools` export on the `./ops` subpath, sourcing the dispatch auth-gate's gated set from the registry (`45dcf66`)
23
+
24
+ ### Changed
25
+ - Extracted 45 tool registrations into `ops-registry.ts` (behavior-preserving) (`c68583a`)
26
+ - `SubstrateIndex` splits lookup maps from the iteration surface (behavior-preserving) (`6fd4813`)
27
+ - Canonicalizer rebuilt to clean-emit (infers schemas from data rather than preserving source shapes); explicit orphan-block registration (`c17d2b6`, `a1ca610`)
28
+ - Neutralized `.project` references in agent-facing guidance strings; converged `/context init` to `<substrate-dir>` (`5024158`, `4b84cb8`, `3bba373`)
29
+ - Stripped development-history canonical-id citations from operator-facing tool/parameter description strings, shipped schemas, and the generated skill (`feedc2a`, `7dc597d`, `1f25e33`)
30
+
31
+ ### Fixed
32
+ - Hardened the nested-id predicate to close required-only / composition / tuple bypasses and guarantee termination; id-uniqueness guard for nested arrays (`8352d92`, `cabb8c3`)
33
+ - `canonicalizeSubstrate` de-nests empty-data and object/composition nested-id schemas (`6e3b3eb`)
34
+ - Isolated child git env from inherited `GIT_DIR`/`GIT_*` (hook leak) (`b12cbf3`)
35
+ - Repointed orientation + bootstrap-state off the unregistered `/context start` (`2301cec`)
36
+ - Corrected LLM-misleading reference and docstrings (`block-api` / `context-sdk` / `context`) to the current content-addressed / edge-based model; regenerated the skill (`e1b7773`)
37
+
38
+ ### Removed
39
+ - Relocated context-dir-migration machinery out of the published package (`65f9897`)
11
40
 
12
- ## [0.1.0] - 2026-03-14
41
+ ## [0.26.0] - 2026-05-25
42
+
43
+ Consolidated history of the package across the `pi-project` → `pi-context` rename through its first public npm release. The package was extracted from `pi-workflows` (as `pi-project`) at `799dee0` (2026-03-16) and renamed to `pi-context` at `6eb5e8b` (lockstep 0.25.0).
13
44
 
14
45
  ### Added
15
- - Block CRUD: `readBlock`, `writeBlock`, `appendToBlock`, `updateItemInBlock` with atomic writes (tmp + rename)
16
- - Write-time schema validation via AJV against `.project/schemas/*.schema.json`
17
- - `ValidationError` class with structured error reporting
18
- - Post-step block validation: `snapshotBlockFiles`, `validateChangedBlocks`, `rollbackBlockFiles`
19
- - Derived project state: `projectState(cwd)` computes all metrics dynamically (source files, tests, phases, block summaries, agents, workflows, schemas, templates, recent commits)
20
- - Block discovery: `availableBlocks(cwd)`, `availableSchemas(cwd)`, `findAppendableBlocks(cwd)`
21
- - Generic block tools: `append-block-item` and `update-block-item` (work with any user-defined block type)
22
- - `/project` command with `status` and `add-work` subcommands
23
- - `PROJECT_DIR` and `SCHEMAS_DIR` constants as single source of truth for `.project/` path
46
+ - Block CRUD: `readBlock`, `writeBlock`, `appendToBlock`, `updateItemInBlock`, `upsertItemInBlock` with atomic writes (tmp + rename) and write-time AJV schema validation against `<contextDir>/schemas/*.schema.json`; `ValidationError` with structured reporting (carried from the pre-rename `pi-project` 0.1.0–0.3.0 baseline)
47
+ - Item-level read tools `readBlockItem` + `readBlockPage`; cross-block join tool `joinBlocks` (HYBRID edge + field) (`154def0`, `337af49`)
48
+ - Generic block tools `append-block-item` / `update-block-item`; block discovery (`availableBlocks`, `availableSchemas`, `findAppendableBlocks`); derived `projectState` / `currentState` with atomic-next derivation (`0cbd676`)
49
+ - Substrate SDK port with config-driven vocabulary registries (`d4ec3ce`)
50
+ - `DispatchContext` attestation surface + schema-write surface; per-field schema-declared identity stamping (`001d11a`, `2ed2102`)
51
+ - Schema versioning ($id + version + $ref composition) + migration registry + shared enum schemas (`899bcc3`)
52
+ - Bootstrap pointer model: `resolveContextDir(cwd)`, `BootstrapNotFoundError`, `writeBootstrapPointer`, `bootstrap.schema.json`, `.pi-context.json` atomic-safety pointer; internal path-builders cascade through the resolver (`909a086`, `bb2c7d5`, `9846b90`)
53
+ - Query/traversal primitives: `filter-block-items`, `resolve-items-by-id` (bulk), `walk-ancestors`, `find-references` — each as library + Pi tool + orchestrator script (`15cd881`, `2ddf85f`, `7cb17f0`, `680cb1c`)
54
+ - `context-contracts` block kind + `gatherExecutionContext` primitive (`6ddb1ba`, `6bea7e1`)
55
+ - PM-lens module (roadmap-plan port + lens-validator dispatch + tools/subcommands); composition-lens dispatch; lens-view consumption surface (`5fe8969`, `3625758`)
56
+ - `read-config` + `read-schema` Pi tools; `list-tools` in-pi tool-discovery; `read-samples-catalog` Pi tool + CLI (`bac1893`, `06c5619`, `641b9a0`)
57
+ - Consumption MVP: `/context init` / `install` / `accept-all` consume packaged `samples/`; packaged `samples/conception.json` manifest + clean edge-based schemas (`458a575`, `b8a9d7e`, `c08f93b`, `ef7feca`, `1fe243d`, `a4c5257`)
58
+ - Config-declared substrate invariants relocated from hardcoded `validateProject` into config data; status-consistency invariant class with cycle-safe status-vocab (`ff5f3f1`, `5758d1f`, `97e095b`)
59
+ - `canonical_id` rename engine (item / relation_type / lens / layer) via `rename-canonical-id` Pi tool (`33b76a7`)
60
+ - Config/schema/edge write ops as dual-surface units: `amend-config`, `write-schema`, `append-relation` (library + Pi tool + CLI) (`2eb9abf`, `7ad8fbd`, `c1e72af`)
61
+ - `deriveBootstrapState` 4-state bootstrap deriver; relation-type endpoint-kind metadata (`752e7e2`, `d1dba88`, `2b4908d`)
62
+
63
+ ### Changed
64
+ - Renamed package `pi-project` → `pi-context` (lockstep 0.25.0); internal vocabulary `/project` → `/context` across tool-name strings, the slash command, docs, and generated skill (`6eb5e8b`, `6eafa77`, `3ab72e0`, `6556073`)
65
+ - `phase` block-kind moved from file-per-phase to array-block (`6815d87`)
66
+ - Six typed-file find-or-merge primitives extracted; existing `.project/`-targeting primitives became thin wrappers; `upsertItemInBlock` preserves `created_by`/`created_at` across update via pre-merge (`1e68034`, `d24769a`)
67
+ - Generalized the block-api validated write surface to `(filePath, schemaPath)` pairs; monitor write-action routed through block-api (`2160c63`, `523fa96`)
68
+ - Migrated pi-mono peer-deps `@mariozechner/*` → `@earendil-works/*` at `^0.74.0` (`e5ab8ad`)
69
+
70
+ ### Fixed
71
+ - Registry schemas gained `$id` + version; `$ref` shared enums where vocabularies align (`a4e8c9c`)
72
+ - Unified substrate path resolution on the pointer + path-traversal guard; empty-prefix guard + cross-block status-vocab check + name-based error catches; `$ref`-aware block-api id-allocation + whole-file CLI validation (`61b7acd`, `4fb4d1e`, `5ecd7bd`)
73
+ - `config.root` optional — conception ships no substrate-dir root (`ce87262`)
74
+
75
+ ### Removed
76
+ - Removed `writeBootstrapPointer` signature default + `initProject` `.project` literal (`f17efa3`)
77
+ - Removed `/project→/context` transition aliases after the migration completed (`6556073`)
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Schema-driven project state management for [Pi](https://github.com/badlogic/pi-mono).
4
4
 
5
- Schemas are the design language. You define what your project tracks by writing JSON Schemas, and the entire system — tools, validation, derived state, workflow integration — adapts automatically. Drop a new `.schema.json` file into `.project/schemas/` and it instantly becomes an addressable block type with write-time validation, discovery, and generic CRUD tooling. No code changes.
5
+ Schemas are the design language. You define what your project tracks by writing JSON Schemas, and the entire system — tools, validation, derived state, workflow integration — adapts automatically. Drop a new `.schema.json` file into `<substrate-dir>/schemas/` and it instantly becomes an addressable block type with write-time validation, discovery, and generic CRUD tooling. No code changes.
6
6
 
7
7
  ## Install
8
8
 
@@ -13,39 +13,77 @@ pi install npm:@davidorex/pi-context
13
13
  ## Getting Started
14
14
 
15
15
  ```
16
- /context init # create the empty substrate skeleton
17
- /context install # reconcile .project/ against installed_* lists in config.json
16
+ /context init <substrate-dir> # create the empty substrate skeleton
17
+ /context install # reconcile <substrate-dir>/ against installed_* lists in config.json
18
18
  ```
19
19
 
20
- `init` is intentionally minimal: it writes the bootstrap pointer + substrate/schemas dirs only — no config, no schemas, no starter blocks (DEC-0011 ship-no-defaults). Adopt the packaged conception with `/context accept-all` (writes `config.json` from `samples/conception.json`), or hand-declare `config.json`'s `installed_schemas` / `installed_blocks`, then run `/context install` (opt-in install ceremony, idempotent, `--update` overwrites). The package-shipped samples catalog (`samples/blocks/` and `samples/schemas/`, per DEC-0037) is the source.
20
+ `init` is intentionally minimal: it writes the bootstrap pointer + substrate/schemas dirs only — no config, no schemas, no starter blocks (ship-no-defaults). Adopt the packaged conception with `/context accept-all` (writes `config.json` from `samples/conception.json`), or hand-declare `config.json`'s `installed_schemas` / `installed_blocks`, then run `/context install` (opt-in install ceremony, idempotent, `--update` overwrites). The package-shipped samples catalog (`samples/blocks/` and `samples/schemas/`) is the source.
21
21
 
22
22
  ## How It Works
23
23
 
24
- Project data lives under the substrate root (the dir chosen at init and recorded in `config.json`'s `root` field by accept-all; no default is shipped — DEC-0015) as typed JSON block files. Each block has a corresponding JSON Schema that defines its shape. All writes — whether from tools, workflows, or agents — are validated against the schema before data hits disk. Invalid data is never persisted.
24
+ Project data lives under the substrate root (the dir chosen at init and recorded in `config.json`'s `root` field by accept-all; no default is shipped) as typed JSON block files. Each block has a corresponding JSON Schema that defines its shape. All writes — whether from tools, workflows, or agents — are validated against the schema before data hits disk. Invalid data is never persisted.
25
25
 
26
- After `/context init` the substrate skeleton is just the dirs (no config, no schemas, no blocks):
26
+ After `/context init <substrate-dir>` the substrate skeleton is just the dirs (no config, no schemas, no blocks):
27
27
 
28
28
  ```
29
- .project/
29
+ <substrate-dir>/
30
30
  schemas/ — empty until accept-all + install
31
31
  ```
32
32
 
33
33
  After `/context accept-all` (writes `config.json` from the packaged conception) + `/context install` (with declared entries) and any user authoring, the directory typically grows:
34
34
 
35
35
  ```
36
- .project/
37
- config.json — substrate bootstrap (always at .project/, exempt from root redirection)
38
- relations.json — closure-table edges (always at .project/, exempt from root redirection)
36
+ <substrate-dir>/
37
+ config.json — substrate bootstrap + substrate_id (always at the substrate-dir root (your chosen dir), exempt from `config.root` redirection)
38
+ relations.json — closure-table edges (always at the substrate-dir root (your chosen dir), exempt from `config.root` redirection)
39
+ migrations.json — per-substrate schema-version migration registry
39
40
  schemas/<name>.schema.json — installed from samples/schemas/, plus any user-authored schemas
41
+ objects/<content_hash>.json — content-addressed object store (one file per content version; git-tracked)
40
42
  <name>.json — installed from samples/blocks/, plus any user-authored blocks
43
+
44
+ <project-root>/
45
+ .pi-context.json — bootstrap pointer naming the single ACTIVE substrate dir (contextDir)
46
+ .pi-context-registry.json — project-root registry enumerating ALL substrates by substrate_id (git-tracked)
41
47
  ```
42
48
 
43
49
  The schema is the contract. When pi-workflows agents produce output that writes to project blocks, the schema enforces the shape. When `/context add-work` extracts items from conversation, the schema constrains what gets written. When `contextState()` derives block summaries, it reads the typed data the schemas guarantee.
44
50
 
45
- **Tools registered:** the tool surface grows with the package — read the generated `skills/pi-context/SKILL.md` for the current set, or call the `list-tools` tool at runtime (in-pi) / `grep pi.registerTool packages/pi-context/src/index.ts` (source). Families: block CRUD (read/write/append/update/remove, top-level + nested), item-level read (`read-block-item`, `read-block-page`), query (`filter-block-items`, `resolve-item(s)-by-id`, `find-references`, `walk-ancestors`, `context-walk-descendants`), substrate write (`append-relation`, `amend-config`, `write-schema`, `rename-canonical-id`), discovery/introspection (`read-config`, `read-schema`, `read-samples-catalog`, `list-tools`, `context-current-state`), lifecycle (`context-init`, `context-accept-all`, `context-status`, `context-validate`, `context-validate-relations`, `complete-task`).
51
+ ### Item identity + content-addressing
52
+
53
+ Every item in an identity-bearing block carries a three-layer identity (the block's schema must declare all three identity fields, or stamping is a no-op):
54
+
55
+ - **`id` (refname)** — the human label, a kind-prefixed refname (e.g. a `DEC-`/`TASK-` id). Mutable; a label, not an identity.
56
+ - **`oid`** — a content-independent 32-hex id minted once at the item's birth and immutable thereafter, salted by the substrate's `substrate_id` so two substrates never collide. A write that carries a different incoming `oid` is rejected.
57
+ - **`content_hash`** — a SHA-256 over the item's *content projection* (the item minus its metadata fields). Identical content yields an identical hash, so duplicate content deduplicates.
58
+ - **`content_parent`** — the prior version's `content_hash`, forming a per-item version chain. It advances only when content actually changed; a metadata-only write carries the prior parent forward.
59
+
60
+ On a stamping write, the content projection is persisted to `<substrate-dir>/objects/<content_hash>.json` — a content-addressed, git-tracked object store (one file per content version). The metadata fields excluded from the hash are the mandatory floor `{id, oid, content_hash, content_parent}` plus a discretionary set (the author fields and `closed_by`/`closed_at`); a schema's item subschema may redefine the discretionary set via `x-identity.metadata_fields`, but the floor is always excluded.
61
+
62
+ ### Cross-substrate: substrate_id + registry
63
+
64
+ Each substrate's `config.json` carries a `substrate_id` (pattern `sub-` + 16 hex), minted once and immutable on disk. A project-root, git-tracked `.pi-context-registry.json` enumerates *all* substrates by `substrate_id` (each mapped to its `dir` and any `aliases`), distinct from the `.pi-context.json` pointer which names only the one active substrate. `resolveRef(cwd, ref)` classifies any endpoint as `active` (resolved in the active substrate), `foreign` (a registered `substrate_id` or `<alias>:<refname>` resolved in another substrate), `dangling` (a registered substrate that lacks the named item), or `unregistered` (a substrate_id/alias the registry does not carry). `validateContext` requires the active `config.substrate_id` to have a matching registry entry, guarding against source-of-truth drift.
65
+
66
+ ### Relations: closure-table edges, structured endpoints
67
+
68
+ All inter-item relationships are closure-table edges in `<substrate-dir>/relations.json` — `{parent, child, relation_type, ordinal?}` rows. Endpoints are dual-form: a legacy string (a canonical id, a lens bin name, or an `<alias>:<refname>` cross-substrate sentinel), or a structured `{kind:"item", oid, refname?, substrate_id?, content_hash?}` (where `substrate_id` marks a foreign endpoint), or a structured `{kind:"lens_bin", bin}` virtual parent. Embedded nested id-bearing arrays and FK-as-field are forbidden (`validateContext` flags `nested_id_bearing_array`); containment is a membership edge carrying `ordinal`, and the nested id-bearing array → top-level entity block + ordinal-bearing membership edges promotion is performed by the canonicalizer (`canonicalize-substrate` tool) — not `promote-item`, which is the separate cross-substrate derivation tool.
69
+
70
+ ### Schema versioning + migrations
71
+
72
+ `<substrate-dir>/migrations.json` is the per-substrate migration registry. A schema `version` bump requires a companion migration declared via `write-schema-migration` — without one, reading or writing an item with an older `schema_version` throws a version mismatch. Migration kinds are `identity` (shape-compatible, no transform) or `declarative-transform` (a spec of rename/set/delete/coerce on dotted paths). The loaded registry walks items forward at the next read/write without a process restart.
73
+
74
+ **Tools registered:** the tool surface grows with the package — read the generated `skills/pi-context/SKILL.md` for the current set, or call the `list-tools` tool at runtime (in-pi) / `grep pi.registerTool packages/pi-context/src/index.ts` (source). Families:
75
+
76
+ - **Block CRUD** — `read-block`, `write-block`, `read-block-dir`, `append-block-item`, `update-block-item`, `remove-block-item`, and the nested-array variants (`append/update/remove-block-nested-item`).
77
+ - **Item-level read/query** — `read-block-item`, `read-block-page`, `filter-block-items`, `resolve-item-by-id`, `resolve-items-by-id`, `join-blocks`, `find-references`, `walk-ancestors`, `context-walk-descendants`, `context-edges-for-lens`, `gather-execution-context`.
78
+ - **Substrate writes** — `append-relation`, `amend-config`, `write-schema`, `write-schema-migration`, `rename-canonical-id`.
79
+ - **Content-addressing lifecycle** — `promote-item` (cross-substrate derivation: promote an item into another registered substrate as a new content-addressed item + `item_derived_from_item` lineage edge), `migrate-content-addressed` (backfill identity), `canonicalize-substrate` (one-time canonicalizer; promotes each nested id-bearing array → top-level entity block + ordinal-bearing membership edges).
80
+ - **Discovery/introspection** — `read-config`, `read-schema`, `read-samples-catalog`, `list-tools`, `context-current-state`, `context-bootstrap-state`.
81
+ - **Lifecycle/state** — `context-status`, `context-validate`, `context-validate-relations`, `complete-task`.
82
+ - **Substrate management** — `context-init`, `context-accept-all`, `context-switch`, `context-list`, `context-archive`.
83
+ - **Roadmap** — `context-roadmap-load`, `context-roadmap-render`, `context-roadmap-validate`, `context-roadmap-list`.
46
84
 
47
85
  **Commands registered:**
48
- - `/context init <dir>` — bootstrap pointer + substrate/schemas dirs only (no config, no defaults)
86
+ - `/context init <substrate-dir>` — bootstrap pointer + substrate/schemas dirs only (no config, no defaults)
49
87
  - `/context accept-all` — adopt `samples/conception.json` as `config.json` (idempotent; never overwrites an existing config)
50
88
  - `/context install [--update]` — reconcile the substrate against `installed_schemas` / `installed_blocks` in `config.json` by copying assets from the samples catalog (skip-if-exists by default; `--update` overwrites)
51
89
  - `/context view <lensId>` — render a configured lens (groupByLens projection) into the conversation as markdown
@@ -59,8 +97,21 @@ The schema is the contract. When pi-workflows agents produce output that writes
59
97
  | File | Purpose |
60
98
  |------|---------|
61
99
  | `src/index.ts` | Extension entry point — tool and command registration |
62
- | `src/block-api.ts` | Block CRUD: `readBlock`, `writeBlock`, `appendToBlock`, `updateItemInBlock`, `appendToNestedArray`, `updateNestedArrayItem`, `removeFromBlock`, `removeFromNestedArray`, `readBlockDir` |
63
- | `src/schema-validator.ts` | AJV wrapper: `validate`, `validateFromFile`, `ValidationError` |
100
+ | `src/block-api.ts` | Block CRUD + identity stamping: `readBlock`, `writeBlock`, `appendToBlock`, `updateItemInBlock`, `appendToNestedArray`, `updateNestedArrayItem`, `removeFromBlock`, `removeFromNestedArray`, `readBlockDir`; mints `oid`/`content_hash`/`content_parent` (`mintOid`, `prepareItemIdentityForWrite`, `contentProjection`), reads `substrate_id` (`substrateIdForDir`). Exported subpath `./block-api`. |
101
+ | `src/content-hash.ts` | RFC 8785 JCS canonicalization SHA-256 content hashing for the content projection. Exported subpath `./content-hash`. |
102
+ | `src/object-store.ts` | Content-addressed object store: writes/reads `<substrate-dir>/objects/<content_hash>.json` (idempotent, atomic tmp+rename). Exported subpath `./object-store`. |
103
+ | `src/context-registry.ts` | Project-root `.pi-context-registry.json` reader/writer: `substrate_id → { dir, aliases[] }`, `resolveSubstrateDir`, `resolveAlias`. Exported subpath `./context-registry`. |
104
+ | `src/promote-item.ts` | Cross-substrate derivation: promotes a substrate item into another registered substrate as a new content-addressed item, recording an `item_derived_from_item` lineage edge in the destination (`promote-item` tool). (Nested id-bearing array → top-level entity + membership edges is the canonicalizer's job — `canonicalize-substrate`.) Exported subpath `./promote-item`. |
105
+ | `src/migrate-content-addressed.ts` | Backfills three-layer identity onto pre-content-addressed items (`migrate-content-addressed` tool). Exported subpath `./migrate-content-addressed`. |
106
+ | `src/canonicalize-substrate.ts` | One-time substrate canonicalizer (`canonicalize-substrate` tool). Exported subpath `./canonicalize-substrate`. |
107
+ | `src/schema-write.ts` | Schema create/replace authoring backing `write-schema`. Exported subpath `./schema-write`. |
108
+ | `src/schema-migrations.ts` | Schema version-bump migration engine (`identity` / `declarative-transform`), backed by `migrations.json`. Exported subpath `./schema-migrations`. |
109
+ | `src/land-identity-fields.ts` | Lands the three identity fields onto an existing schema's item subschema. Exported subpath `./land-identity-fields`. |
110
+ | `src/read-element.ts` | Element-level substrate read helper. Exported subpath `./read-element`. |
111
+ | `src/dispatch-context.ts` | `DispatchContext` / `WriterIdentity` attestation types stamped onto block-api writes. Exported subpath `./dispatch-context`. |
112
+ | `src/rename-canonical-id.ts` | Renames a canonical id across blocks + relations (`rename-canonical-id` tool). Exported subpath `./rename-canonical-id`. |
113
+ | `src/samples-catalog.ts` | Reads the packaged conception/samples catalog. Exported subpath `./samples-catalog`. |
114
+ | `src/schema-validator.ts` | AJV wrapper: `validate`, `validateFromFile`, `ValidationError`. Exported subpath `./schema-validator`. |
64
115
  | `src/block-validation.ts` | Post-step validation: `snapshotBlockFiles`, `validateChangedBlocks`, `rollbackBlockFiles` |
65
116
  | `src/context-sdk.ts` | Derived state + cross-block resolver: `contextState`, `availableBlocks`, `availableSchemas`, `findAppendableBlocks`, `validateContext`, `buildIdIndex`, `resolveItemById`, `completeTask`. Re-exports the substrate API from `context.ts` (config/relations loaders, lens algorithms, validators, `resolveContextDir`) so existing consumers get one import surface. |
66
117
  | `src/context.ts` | Substrate bootstrap: `loadConfig`, `loadRelations`, `loadContext` (mtime-keyed cache), `resolveContextDir(cwd)` (the `config.root` resolver every path helper routes through), the lens algorithms (`edgesForLens`, `synthesizeFromField`, `walkDescendants`, `groupByLens`, `listUncategorized`, `displayName`), `validateRelations`. Type exports: `ConfigBlock`, `HierarchyDecl`, `LensSpec`, `Edge`, `ItemRecord`, `ContextData`, `SubstrateValidationIssue`, `SubstrateValidationResult`, `CurationSuggestion`. |
@@ -131,7 +182,7 @@ validateRelations(cwd, options?): SubstrateValidationResult
131
182
  displayName(canonicalId: string, naming: Record<string, string> | undefined): string
132
183
  ```
133
184
 
134
- `config.root` is the substrate's "where do I live" answer — block-api, schemas-discovery, phase-discovery, and every other path consumer route through `resolveContextDir(cwd)` so a relocated root reaches the runtime instead of being trapped in the SDK. `config.json` and `relations.json` themselves are exempt — they always live at `.project/` because they are the substrate that defines `root`.
185
+ `config.root` is the substrate's "where do I live" answer — block-api, schemas-discovery, phase-discovery, and every other path consumer route through `resolveContextDir(cwd)` so a relocated root reaches the runtime instead of being trapped in the SDK. `config.json` and `relations.json` themselves are exempt — they always live at the substrate-dir root (the bootstrap-chosen dir, pointer-resolved, suggested `.context`) because they are the substrate that defines `root`.
135
186
 
136
187
  ### Lens View Consumption (`src/lens-view.ts`)
137
188
 
@@ -175,9 +226,11 @@ When working with this extension:
175
226
  - **Read `src/context-sdk.ts`** to understand what project state is available and how it's computed
176
227
  - **Read `src/block-api.ts`** to understand the CRUD operations and validation behavior
177
228
  - **Read `src/index.ts`** to see tool parameter schemas and command handler logic
178
- - Use the `append-block-item` tool to add items — it handles schema validation, duplicate checking, and atomic writes
179
- - Use the `update-block-item` tool with a `match` predicate (e.g., `{ id: "gap-123" }`) and `updates` object
180
- - Block schemas define the contract — consult `.project/schemas/*.schema.json` to understand what fields are required
229
+ - Use the `append-block-item` tool to add items — it handles schema validation, duplicate checking, atomic writes, and (for identity-bearing schemas) minting `oid`/`content_hash`/`content_parent` + persisting the content projection to `objects/`
230
+ - Use the `update-block-item` tool with a `match` predicate (e.g., `{ id: "gap-123" }`) and `updates` object — `oid` is immutable, so a mismatched incoming `oid` is rejected
231
+ - Block schemas define the contract — consult `<substrate-dir>/schemas/*.schema.json` to understand what fields are required; a schema declaring all three identity fields opts the block into content-addressing
232
+ - Items reference each other only through closure-table edges in `relations.json` (structured `{kind:"item", oid, refname?, substrate_id?}` or `{kind:"lens_bin", bin}` endpoints) — no FK-as-field, no nested id-bearing arrays
233
+ - Cross-substrate endpoints resolve through `.pi-context-registry.json`; use `resolveRef(cwd, ref)` to classify a reference as active/foreign/dangling/unregistered
181
234
  - `contextState(cwd)` is the single source of truth for project metrics — prefer it over manual filesystem inspection
182
235
 
183
236
  ## Tests
@@ -1,4 +1,149 @@
1
1
  import type { DispatchContext } from "./dispatch-context.js";
2
+ /**
3
+ * The MANDATORY content/metadata floor (content-addressed substrate identity,
4
+ * Cycle 3 / carried item 1; v3 spec §A2). The identity/addressing fields
5
+ * `id`, `oid`, `content_hash`, `content_parent` are ALWAYS metadata —
6
+ * EXCLUDED from the content hash — and a schema's `x-identity.metadata_fields`
7
+ * override can NEVER pull them into the content. This is the floor that makes
8
+ * the content hash a faithful identity for content rather than for addressing:
9
+ * a refname rename (`id`), a freshly-minted `oid`, or a recomputed
10
+ * `content_hash` / advanced `content_parent` must never move the hash, or the
11
+ * object store would fork on pure addressing churn. `metadataFieldsForSchema`
12
+ * unions this floor into whatever partition an override declares so the floor
13
+ * is non-overridable by construction.
14
+ */
15
+ export declare const MANDATORY_METADATA_FIELDS: ReadonlySet<string>;
16
+ /**
17
+ * The DISCRETIONARY metadata fields (v3 spec §A2): the four author/attestation
18
+ * fields (`AUTHOR_FIELDS`) plus the lifecycle-closure fields (`closed_by`,
19
+ * `closed_at`). These are the fields a schema MAY redefine via an
20
+ * `x-identity.metadata_fields` override — when an override is declared it
21
+ * REPLACES this discretionary set (the floor is still unioned back in); when
22
+ * absent these are the discretionary defaults. Built from `AUTHOR_FIELDS` so
23
+ * the four author strings keep a single source of truth and cannot drift from
24
+ * the stamping path.
25
+ */
26
+ export declare const DISCRETIONARY_METADATA_FIELDS: ReadonlySet<string>;
27
+ /**
28
+ * The default content/metadata partition when no `x-identity.metadata_fields`
29
+ * override is declared: `MANDATORY ∪ DISCRETIONARY` — the same 10 fields the
30
+ * Cycle-2 surface enumerated (`id`, `oid`, `content_hash`, `content_parent`,
31
+ * the four author fields, `closed_by`, `closed_at`). Retained as the
32
+ * no-override default so the membership is identical to the pre-Cycle-3 set;
33
+ * `metadataFieldsForSchema` now composes it from the two named subsets rather
34
+ * than a flat literal so the mandatory floor is provably a subset of every
35
+ * resolved partition (see that function).
36
+ */
37
+ export declare const DEFAULT_METADATA_FIELDS: ReadonlySet<string>;
38
+ /**
39
+ * The content/metadata partition for items of array `arrayKey` under `schema`:
40
+ * `MANDATORY_METADATA_FIELDS ∪ (override ?? DISCRETIONARY_METADATA_FIELDS)`
41
+ * (carried item 1 / v3 spec §A2). The item subschema's
42
+ * `x-identity.metadata_fields` override, when declared, REPLACES the
43
+ * discretionary set; the mandatory floor (`id`/`oid`/`content_hash`/
44
+ * `content_parent`) is then unioned back in so an override can never pull a
45
+ * floor field into the content — even an override that omits `id` still
46
+ * excludes the floor, so two items differing only in `id` hash equal under
47
+ * that override. When no override is declared the result equals
48
+ * `DEFAULT_METADATA_FIELDS` (floor ∪ discretionary) byte-for-byte.
49
+ *
50
+ * Single reader — both the cache populate site (`getSchemaCacheEntry` via
51
+ * `collectArrayItemMetadataOverrides`) and `contentProjection` route through
52
+ * this so there is exactly one resolution path and no parallel default.
53
+ * Resolves the item subschema by the same array-key traversal used for
54
+ * author-field decisions, reading the RAW override (not the already-defaulted
55
+ * collected value) so the union is over the override itself.
56
+ */
57
+ export declare function metadataFieldsForSchema(schema: unknown, arrayKey: string): ReadonlySet<string>;
58
+ /**
59
+ * Human-readable description of how a schema's `x-identity.metadata_fields`
60
+ * override changes the discretionary metadata partition relative to the
61
+ * default — or `null` when NO array item subschema declares an override
62
+ * (carried item 2 / informed-authorization confirm). Pure function: no
63
+ * filesystem, no cache; takes a parsed schema object and inspects every
64
+ * reachable array item subschema for an `x-identity.metadata_fields`
65
+ * declaration.
66
+ *
67
+ * When at least one override is present, returns a one-line-per-array summary
68
+ * naming, per array key, which DISCRETIONARY fields the override DROPS
69
+ * (present in `DISCRETIONARY_METADATA_FIELDS` but absent from the override)
70
+ * and which non-floor fields it ADDS (present in the override, not a floor
71
+ * field, not a default discretionary field). The mandatory floor
72
+ * (`id`/`oid`/`content_hash`/`content_parent`) is never reported as
73
+ * add/drop — it is structurally unaffected by an override — so the caller
74
+ * (auth-gate) can append a standing "floor remains excluded" affirmation.
75
+ *
76
+ * Used by `authGateHandler` to enrich the `write-schema` confirm message; the
77
+ * exact wording is the affordance, not a parse contract.
78
+ */
79
+ export declare function describeIdentityOverride(schema: unknown): string | null;
80
+ /**
81
+ * Project an item to its hashable content: a SHALLOW COPY of `item` with the
82
+ * metadata keys (`metadataFieldsForSchema(schema, arrayKey)`) deleted. Does
83
+ * NOT mutate `item`. The result is what Cycle 3 will feed to
84
+ * `computeContentHash`, so a metadata-only mutation (refreshed author stamp,
85
+ * freshly-assigned `oid`, etc.) leaves the projection — and therefore the
86
+ * content hash — unchanged.
87
+ *
88
+ * `schema` is the parsed schema object (not a path), so this is usable both
89
+ * from the cache populate path and from ad-hoc callers / tests holding an
90
+ * inline schema.
91
+ */
92
+ export declare function contentProjection(schema: Record<string, unknown>, arrayKey: string, item: Record<string, unknown>): Record<string, unknown>;
93
+ /**
94
+ * Mint a fresh OID for an item being born in `substrateId`. An OID is the
95
+ * substrate-stable, content-INDEPENDENT identity of an item across all its
96
+ * content versions (vs. `content_hash`, which moves with content; vs. `id`,
97
+ * the human refname). Derived as the first 32 hex chars of
98
+ * `sha256Hex(canonicalJson([substrateId, nonce ?? randomUUID()]))`:
99
+ * - salting with `substrateId` makes two substrates that mint with the same
100
+ * nonce produce distinct OIDs (cross-substrate uniqueness — the reason
101
+ * Cycle 3 needs the substrate_id core);
102
+ * - `nonce` is optional and exists for deterministic tests; production calls
103
+ * pass none and get a fresh `randomUUID()` so each birth is unique even
104
+ * within one substrate.
105
+ * 128 bits (32 hex) of digest is collision-free in the item-count regime.
106
+ *
107
+ * RETURN SHAPE: a bare 32-character lowercase-hex digest — no substrate prefix,
108
+ * no colon separator. `substrateId` salts the hash and does NOT appear in the
109
+ * returned value. (The `<substrate_id>:<oid>` colon-form seen elsewhere is the
110
+ * edge dedup key in `endpointIdentity`, not the oid itself.)
111
+ */
112
+ export declare function mintOid(substrateId: string, nonce?: string): string;
113
+ /**
114
+ * Compute the content/identity fields for an item about to be written, per the
115
+ * content-addressed substrate identity model (Cycle 3 / Phase C). Returns the
116
+ * item with `oid` / `content_hash` / `content_parent` set; the input is never
117
+ * mutated (a shallow copy is returned). Also persists the content projection to
118
+ * the object store as a side effect on every stamping write.
119
+ *
120
+ * NO-OP GATE (locked decision 1): when the item's array subschema does not
121
+ * declare all three identity fields, the original `item` is returned unchanged
122
+ * (no oid mint, no hash, no object write, no substrate_id read). This scopes
123
+ * the behavior change to exactly the schemas Cycle 3 edits — bespoke test
124
+ * schemas without the fields are untouched — mirroring `maybeStampItem`'s
125
+ * author-field gate. The gate is NOT ctx-gated: content hash / oid are
126
+ * integrity, not attestation.
127
+ *
128
+ * Ordering vs author-stamp: call AFTER `maybeStampItem`/`maybeStampTypedItem`.
129
+ * Author fields are in the metadata partition (excluded from the projection),
130
+ * so the content hash is invariant to whether author-stamping ran first — but
131
+ * `content_hash` itself is a metadata field, so it must be assigned AFTER the
132
+ * projection is computed from the (already author-stamped) item.
133
+ *
134
+ * `mode`:
135
+ * - `"create"`: mint a fresh `oid` (via `substrateIdForDir(substrateDir)`),
136
+ * compute `content_hash`, set NO `content_parent` (a v1 item has no prior).
137
+ * - `"update"`: preserve `prior.oid` — and THROW if the incoming item carries
138
+ * a different `oid` (locked decision 3: oid is immutable). Recompute
139
+ * `content_hash`. When the content changed (new hash !== prior.content_hash)
140
+ * set `content_parent = prior.content_hash`; when content is unchanged
141
+ * (no-op write) leave `content_parent` at the prior value (not advanced).
142
+ *
143
+ * `prior` is the on-disk item being replaced (required for `"update"`); for
144
+ * `"create"` it is ignored.
145
+ */
146
+ export declare function prepareItemIdentityForWrite(substrateDir: string, blockName: string, item: Record<string, unknown>, schemaPath: string | null, arrayKey: string, mode: "create" | "update", prior?: Record<string, unknown>): Record<string, unknown>;
2
147
  /**
3
148
  * Read and parse a .project/{blockName}.json file.
4
149
  * Throws if the file does not exist or contains invalid JSON.
@@ -7,6 +152,10 @@ import type { DispatchContext } from "./dispatch-context.js";
7
152
  * matching items in the specified array key. Non-array or missing keys return the
8
153
  * block unchanged. The filter is applied after parsing, before returning.
9
154
  */
155
+ export declare function readBlockForDir(substrateDir: string, blockName: string, filter?: {
156
+ arrayKey: string;
157
+ predicate: (item: Record<string, unknown>) => boolean;
158
+ }): unknown;
10
159
  export declare function readBlock(cwd: string, blockName: string, filter?: {
11
160
  arrayKey: string;
12
161
  predicate: (item: Record<string, unknown>) => boolean;
@@ -34,24 +183,6 @@ export declare function readBlock(cwd: string, blockName: string, filter?: {
34
183
  * for existing callers.
35
184
  */
36
185
  export declare function writeTypedFile(filePath: string, schemaPath: string | null, data: unknown, ctx?: DispatchContext, errorLabel?: string): void;
37
- /**
38
- * Validated atomic append to an array within a `(filePath, schemaPath)` pair.
39
- * `arrayPath = null` means "the file IS the array" (top-level array shape,
40
- * e.g. monitor patterns / instructions); `arrayPath = string` means
41
- * "data[arrayPath] is the target array" (object-with-array-field shape, the
42
- * `.project/` block convention).
43
- *
44
- * `ctx` (FGAP-004): when provided AND the schema declares author fields on
45
- * the items reached by `arrayPath` (or, for the flat-array case, on the
46
- * array's `items.properties.*`), the appended item is stamped via
47
- * `stampItem` in create-mode before AJV validation. For the flat-array
48
- * case the array key passed to the per-array-key cache lookup is the
49
- * arbitrary token `__top__` — `collectArrayItemAuthorDecisions` only
50
- * traverses `properties.*` paths and never visits a top-level array
51
- * schema, so the lookup will always miss; flat-array stamping is
52
- * intentionally a no-op until a schema actually declares author fields
53
- * on a top-level array shape (no current consumer does so).
54
- */
55
186
  export declare function appendToTypedFile(filePath: string, schemaPath: string | null, arrayPath: string | null, item: unknown, ctx?: DispatchContext, errorLabel?: string): void;
56
187
  /**
57
188
  * Validated atomic bulk append-if-absent to an array within a
@@ -180,6 +311,7 @@ export declare function removeFromNestedTypedFile(filePath: string, schemaPath:
180
311
  * stamping; callers wanting per-item attribution should prefer the
181
312
  * array-grained writers.
182
313
  */
314
+ export declare function writeBlockForDir(substrateDir: string, blockName: string, data: unknown, ctx?: DispatchContext): void;
183
315
  export declare function writeBlock(cwd: string, blockName: string, data: unknown, ctx?: DispatchContext): void;
184
316
  /**
185
317
  * Read current file, push item onto data[arrayKey], validate whole file
@@ -193,6 +325,7 @@ export declare function writeBlock(cwd: string, blockName: string, data: unknown
193
325
  * `additionalProperties: false` AJV failures on blocks whose item shape
194
326
  * doesn't carry author markers yet.
195
327
  */
328
+ export declare function appendToBlockForDir(substrateDir: string, blockName: string, arrayKey: string, item: unknown, ctx?: DispatchContext): void;
196
329
  export declare function appendToBlock(cwd: string, blockName: string, arrayKey: string, item: unknown, ctx?: DispatchContext): void;
197
330
  /**
198
331
  * Find an item in data[arrayKey] by predicate, shallow-merge updates onto it,
@@ -204,6 +337,7 @@ export declare function appendToBlock(cwd: string, blockName: string, arrayKey:
204
337
  * update-mode after the shallow merge — `created_by` / `created_at` are
205
338
  * preserved, `modified_by` / `modified_at` refresh.
206
339
  */
340
+ export declare function updateItemInBlockForDir(substrateDir: string, blockName: string, arrayKey: string, predicate: (item: Record<string, unknown>) => boolean, updates: Record<string, unknown>, ctx?: DispatchContext): void;
207
341
  export declare function updateItemInBlock(cwd: string, blockName: string, arrayKey: string, predicate: (item: Record<string, unknown>) => boolean, updates: Record<string, unknown>, ctx?: DispatchContext): void;
208
342
  /**
209
343
  * Atomically find-or-append a single item in `data[arrayKey]` keyed by
@@ -231,6 +365,9 @@ export declare function updateItemInBlock(cwd: string, blockName: string, arrayK
231
365
  * to merge against. Callers that need merge-on-update should continue to
232
366
  * use `updateItemInBlock`.
233
367
  */
368
+ export declare function upsertItemInBlockForDir(substrateDir: string, blockName: string, arrayKey: string, item: Record<string, unknown>, idField: string, ctx?: DispatchContext): {
369
+ mode: "appended" | "updated";
370
+ };
234
371
  export declare function upsertItemInBlock(cwd: string, blockName: string, arrayKey: string, item: Record<string, unknown>, idField: string, ctx?: DispatchContext): {
235
372
  mode: "appended" | "updated";
236
373
  };
@@ -246,6 +383,7 @@ export declare function upsertItemInBlock(cwd: string, blockName: string, arrayK
246
383
  * file lock, predicate findIndex, multi-match warning, clone-before-write so
247
384
  * the original array remains unmodified if writeBlock throws.
248
385
  */
386
+ export declare function appendToNestedArrayForDir(substrateDir: string, blockName: string, parentArrayKey: string, predicate: (item: Record<string, unknown>) => boolean, nestedArrayKey: string, item: unknown, ctx?: DispatchContext): void;
249
387
  export declare function appendToNestedArray(cwd: string, blockName: string, parentArrayKey: string, predicate: (item: Record<string, unknown>) => boolean, nestedArrayKey: string, item: unknown, ctx?: DispatchContext): void;
250
388
  /**
251
389
  * Atomically update a single item inside a nested array on a parent-array
@@ -259,6 +397,7 @@ export declare function appendToNestedArray(cwd: string, blockName: string, pare
259
397
  * updateItemInBlock convention). Clone-then-write keeps the original arrays
260
398
  * unmodified if writeBlock throws.
261
399
  */
400
+ export declare function updateNestedArrayItemForDir(substrateDir: string, blockName: string, parentArrayKey: string, parentPredicate: (item: Record<string, unknown>) => boolean, nestedArrayKey: string, nestedPredicate: (item: Record<string, unknown>) => boolean, updates: Record<string, unknown>, ctx?: DispatchContext): void;
262
401
  export declare function updateNestedArrayItem(cwd: string, blockName: string, parentArrayKey: string, parentPredicate: (item: Record<string, unknown>) => boolean, nestedArrayKey: string, nestedPredicate: (item: Record<string, unknown>) => boolean, updates: Record<string, unknown>, ctx?: DispatchContext): void;
263
402
  /**
264
403
  * Atomically remove all items matching `predicate` from a top-level array
@@ -269,6 +408,9 @@ export declare function updateNestedArrayItem(cwd: string, blockName: string, pa
269
408
  * without throwing — removal of a non-existent item is treated as an
270
409
  * idempotent successful no-op, distinct from update which throws on miss.
271
410
  */
411
+ export declare function removeFromBlockForDir(substrateDir: string, blockName: string, arrayKey: string, predicate: (item: Record<string, unknown>) => boolean, ctx?: DispatchContext): {
412
+ removed: number;
413
+ };
272
414
  export declare function removeFromBlock(cwd: string, blockName: string, arrayKey: string, predicate: (item: Record<string, unknown>) => boolean, ctx?: DispatchContext): {
273
415
  removed: number;
274
416
  };
@@ -282,6 +424,9 @@ export declare function removeFromBlock(cwd: string, blockName: string, arrayKey
282
424
  * mirrors removeFromBlock semantics). Multi-match warning at parent level
283
425
  * via console.error.
284
426
  */
427
+ export declare function removeFromNestedArrayForDir(substrateDir: string, blockName: string, parentArrayKey: string, parentPredicate: (item: Record<string, unknown>) => boolean, nestedArrayKey: string, nestedPredicate: (item: Record<string, unknown>) => boolean, ctx?: DispatchContext): {
428
+ removed: number;
429
+ };
285
430
  export declare function removeFromNestedArray(cwd: string, blockName: string, parentArrayKey: string, parentPredicate: (item: Record<string, unknown>) => boolean, nestedArrayKey: string, nestedPredicate: (item: Record<string, unknown>) => boolean, ctx?: DispatchContext): {
286
431
  removed: number;
287
432
  };
@@ -296,6 +441,7 @@ export declare function removeFromNestedArray(cwd: string, blockName: string, pa
296
441
  * byte-identically; both pi-workflows and the `read-block-dir` registered
297
442
  * tool consume this single export.
298
443
  */
444
+ export declare function readBlockDirForDir(substrateDir: string, subdir: string): unknown[];
299
445
  export declare function readBlockDir(cwd: string, subdir: string): unknown[];
300
446
  /**
301
447
  * Resolve the item subschema for a block schema: find the first array property
@@ -324,5 +470,6 @@ export declare function resolveBlockItemSchema(schema: Record<string, unknown>):
324
470
  * prefix+width parseable. Orchestrator CLIs + the in-pi append tool route
325
471
  * through this instead of re-implementing allocation.
326
472
  */
473
+ export declare function nextIdForDir(substrateDir: string, blockName: string): string;
327
474
  export declare function nextId(cwd: string, blockName: string): string;
328
475
  //# sourceMappingURL=block-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block-api.d.ts","sourceRoot":"","sources":["../src/block-api.ts"],"names":[],"m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