SDK Primitive Inventory
Tracked work: pm-lodl, pm-8778, pm-rjqr, pm-oslr, pm-6qiwan, capstone pm-9x6e, parent pm-usfg.
This inventory records the completed SDK-first migration for the principle project management = context management.
CLI and MCP modules now import shared host services through src/sdk/runtime-primitives.ts; direct src/core imports, type-only edges, re-exports, and computed dynamic imports are unconditionally rejected by the static quality gate. There is no allowance file or ratchet escape hatch.
Enforced Boundary
- Boundary scope:
src/cli.ts,src/cli/**,src/mcp.ts, andsrc/mcp/**. - Required private-edge count: zero.
- The retired ratchet ended at 48 CLI/MCP source modules and 407 private-core import edges before the capstone moved every remaining edge behind the public SDK seam.
- Type-only imports and re-exports are intentionally counted because they still expose presentation layers to private core contracts.
- Gate foundation: pm-8778; zero-boundary capstone: pm-9x6e.
- Rule: presentation code adds or extends an SDK primitive first; no CLI/MCP exception can be recorded.
Public Presentation Runtime
src/sdk/runtime-primitives.ts is the curated low-level seam for presentation hosts. It exposes filesystem, schema, history, extension-runtime, telemetry, search, output, and storage services needed to compose the shipped CLI and MCP adapters. External integrations should still prefer typed PmClient and top-level SDK operations; runtime primitives exist for embedded hosts that need to build an equivalent presentation layer without private imports.
Tracker Preflight Primitive
assertInitializedTracker is the shared SDK boundary for commands that require
an initialized project, while assertReadableTrackerRoot supports low-level
metadata enumeration that intentionally accepts an empty directory. The former
replaced 50 literal checks across 45 SDK modules. It preserves one structured
error vocabulary and one exact recovery contract for CLI, MCP dispatch through
the SDK runtime, first-party packages, and external SDK consumers.
The preflight is public from the aggregate SDK; its four-state static recovery
corpus is also public from @unbrained/pm-cli/sdk/contracts. A source-derived
ratchet prevents the adoption count from falling below 50 and refuses the old
inline tracker-not-initialized message anywhere under src/sdk.
Promotion Partition
| Promotion item | Primitive family | Primary private domains to promote |
|---|---|---|
| pm-98cz | Item lifecycle | core/item, core/store, core/lock, mutation checkpoints |
| pm-rjqr | Query and read | core/search, read projections, context/next/list/get aggregation |
| pm-zwpp | Annotations and links | comments, notes, learnings, files, docs, deps, append metadata |
| pm-3mna | Workspace customization | core/schema, core/config, profiles, init presets |
| pm-oxrw | Governance and maintenance | validate, health, gc, normalize, issue-code and remediation surfaces |
| pm-4a7m | History maintenance | history read, redact, repair, compact, restore history replay |
| pm-je50 | Plan workflow | plan steps, dependencies, decisions, discoveries, validation, materialization |
| pm-oslr | Execution and diagnostics | linked-test running, test-run lifecycle, eval, telemetry stats/export |
Command Family Map
| CLI/MCP source family | SDK destination | Notes |
|---|---|---|
create, update, update-many, copy, delete, restore |
pm-98cz | Item CRUD and replay paths should become typed lifecycle SDK calls. |
claim, release, focus, lifecycle shortcut helpers |
pm-98cz | Ownership and actionable-state changes belong beside lifecycle primitives. |
list, get, search, context, next, aggregate, stats |
pm-rjqr | list and search implementations now live under src/sdk/query/**; remaining read models should follow the same SDK-owned pattern. |
comments, notes, learnings, files, docs, deps, append |
pm-zwpp | Annotation/link mutation semantics must be stable SDK primitives. |
schema, config, profile, init, init-agent-guidance |
pm-3mna | Universal customization requires programmatic schema, profile, and config APIs. |
history, activity, history-redact, history-repair, history-compact |
pm-4a7m | Audited history read, activity, rewrite, and checkpoint operations need explicit public contracts. |
plan |
pm-je50 | Plan harness operations should be usable by external orchestrators through SDK calls. |
test, test-all, test-runs, eval, telemetry, stats |
pm-oslr | Implementations live under src/sdk/test/**, src/sdk/eval.ts, src/sdk/telemetry.ts, and src/sdk/stats.ts; CLI paths are compatibility exports with typed structured results. |
reindex |
pm-rjqr / pm-9x6e | Search-index refresh remains part of the query/read ownership and terminal boundary burn-down. |
extension, upgrade, package lifecycle helpers |
pm-ugqx | Existing package-author SDK surfaces stay public; package lifecycle can move behind SDK runtime helpers. |
src/mcp/** |
pm-usfg | MCP tools should call SDK primitives directly once each family is promoted. |
Boundary Workflow
- Add or extend a typed primitive under
src/sdk. - Consume it from CLI/MCP through an SDK module; never deep-import
src/core. - Run
pnpm quality:static; the gate must reportactual_edge_count: 0and no unsupported dynamic imports. - Exercise both the public SDK contract and the presentation adapter in focused tests.
- Link source, docs, tests, and evidence to the owning
pmitem.