Pi package with agent-first skills and prompt templates for structured codebase understanding, safe greenfield starts, safe changes, architecture-aware review, and migration from deprecated prose docs.
Legacy prose-style project-agent docs are deprecated. Current workflows treat docs/agent/api as a logical layout under a resolved structured docs root:
<docs-root>/repo/*.yaml
<docs-root>/scopes/by-path/<repo-relative-path>/*.yaml
<docs-root>/scopes/by-domain/<slug>/*.yaml
Resolution rules:
- resolve
workspace_rootwithgit rev-parse --show-toplevel 2>/dev/nullor fallback topwd - canonicalize
workspace_rootbefore fingerprinting when possible (realpath,pwd -P,Path(...).resolve(), or equivalent) safe-startcreates and uses the initial repo-local root at<workspace_root>/docs/agent/api- other skills use repo-local only when that root already exists
- otherwise use the global overlay root
~/.pi/agent/workspaces/<workspace-fingerprint>/docs/agent/api - compute
<workspace-fingerprint>exactly from canonicalworkspace_root: strip one leading slash/backslash, replace every slash, backslash, and colon with-, then wrap with-- - example:
/data/data/com.termux/files/home/CodeProjects/pi-mono->--data-data-com.termux-files-home-CodeProjects-pi-mono--
No workflow generates docs/agent/*.md, scoped Markdown docs, or README files as project-agent artifacts. Structured YAML is the API for further transformation and agent ingestion. Root AGENTS.md remains a compact harness interoperability file generated from agent-operating-guide.yaml, because not every coding harness consumes these skills/prompts directly.
All skills follow a Structured Artifact Write/Update Protocol: resolve scope and owner artifact first, read before write, preserve stable IDs, upsert by ID/source-of-truth fields, mark unsupported records stale/deprecated instead of deleting, require evidence, validate references, format YAML deterministically, and report validation.
safe-start— create new projects with structured intent, data, architecture, contracts, validation, and handoff artifacts.codebase-recon— reconstruct existing codebases into structured YAML artifacts under the resolved structured docs root.safe-change— make documented-codebase changes using structured artifacts and update owner YAML only when durable semantics change.arch-code-review— review diffs against structured architecture, data, invariant, dependency, risk, contract, and test artifacts from the resolved structured docs root.structured-docs-migration— migrate deprecated prose-style docs into canonical structured YAML artifacts under the resolved structured docs root.
Reconstruction:
/recon-all/recon-01-inventory/recon-02-architecture/recon-03-data-invariants/recon-04-dependency-rules/recon-05-risk-register/recon-06-agents— writesagent-operating-guide.yamland rootAGENTS.md/recon-07-change-guide/recon-08-consolidate/recon-09-adr/recon-10-risk-tests
Safe start:
/safe-start-all/safe-start-01-intent/safe-start-02-data-flow/safe-start-03-architecture/safe-start-04-contract-docs/safe-start-05-scaffold-plan/safe-start-06-validation/safe-start-07-vertical-slice/safe-start-08-handoff
Safe change / review / migration:
/preflight/bug-diagnose/bug-implement/feature-design/feature-implement/refactor-design/refactor-implement/risk-fix/review-arch/migrate-structured-docs
From git after repository is published:
pi install git:github.com/PriNova/pi-agent-codebase-workflowsFrom npm after package is published:
pi install npm:pi-agent-codebase-workflowsLocal development/test:
pi install /absolute/path/to/pi-agent-codebase-workflows
# or one-off
pi -e /absolute/path/to/pi-agent-codebase-workflowsPrompts accept optional focus/scope arguments. Path-like focus writes under:
<docs-root>/scopes/by-path/<focus>/
Domain-like focus writes under:
<docs-root>/scopes/by-domain/<slug>/
<docs-root>/repo/scopes.yaml is the canonical scope registry. Path scopes match by longest prefix. Domain scopes require explicit task/domain/contract refs.
scopes.yaml: scope routing and ownership.repo-inventory.yaml: structure, entry points, command index, boundaries.validation-baseline.yaml: command status, blockers, validation order.project-intent.yaml: goals, users, journeys, constraints.architecture.yaml: components, style, side-effect boundaries.data-flow.yaml: typed flow graph and error states.data-model.yaml: entities, IDs, schemas, lifecycles, serialized formats.invariants.yaml: rules, forbidden states, enforcement.dependency-rules.yaml: layers, allowed/forbidden dependencies, violations.design-issues.yaml: drift, deferred decisions, ownership gaps.risk-register.yaml: failure modes and suggested tests/fixes.contracts.yaml: APIs, schemas, events, generated clients, persistence/deployment/env contracts.testing-strategy.yaml: test topology, gaps, risk-to-test priorities.change-guide.yaml: workflow routing and checklists.adr.yaml: structured ADR records.agent-operating-guide.yaml: structured operational rules for agents; rootAGENTS.mdmirrors compact harness-facing guidance.
Runtime schema assets are shared under skills/_shared/references/. Skills load ../_shared/references/artifact-api.md, ../_shared/references/schemas/common.schema.json, and the matching artifact schema(s) for files they write. _shared has no SKILL.md, so Pi does not discover it as a skill.
Project docs outside the shared runtime refs may exist in the source repo, but are not runtime instructions for installed extension users.
Validation is best-effort by agent inspection and re-read.
skills/
_shared/references/artifact-api.md
_shared/references/schemas/*.schema.json
*/SKILL.md
prompts/
*.md
Pi discovers skills and prompts through the pi.skills and pi.prompts entries in package.json.