feat(specs): user-definable spec types as type cards (skills-for-specs) - #232
Draft
Rustam Sadykov (SBOne-Kenobi) wants to merge 5 commits into
Draft
feat(specs): user-definable spec types as type cards (skills-for-specs)#232Rustam Sadykov (SBOne-Kenobi) wants to merge 5 commits into
Rustam Sadykov (SBOne-Kenobi) wants to merge 5 commits into
Conversation
This reverts commit a85d848.
A skills-like system for spec types: one markdown card per type (human-first prose + a small machine-readable frontmatter core) resolved through a registry — project .pi/spec-types/ wins over seven built-ins (the original five plus charter and decision). lifecycle (durable/ephemeral) is first-class; ephemeral specs end by promotion, never authority. - pi-spec-graph/core: card parser + SpecTypeRegistry (revalidate-on-read); built-ins embedded as string constants (bundle-safe — core is compiled into the binary); SPEC_TYPES tuple removed, the registry replaces it - tools: new spec_types (list, or one card in full); spec_create validates type + per-card statuses against the registry and scaffolds from the card (Template > sections) - skill: registry-driven Types section + read-the-card-before-authoring norm - wire v38: SpecGraphSnapshot.types + scoped spec.saveTypeCard (slug and is-a-card validated server-side; writes only .pi/spec-types/) - server/spec: registry in the snapshot; projectHasSpecs lifecycle-driven - web: type-aware Specs rows (description tooltips, ephemeral dimming), a types legend, and the SpecTypeDialog constructor (guided form, live preview)
Collaborator
Author
The chat side — the agent using the type registry (live run)The other half of the system: what the agent does with type cards in a chat. This is a real Prompt: "Run spec_types to list this project's registered spec types. Then read the decision type card and create one decision spec with spec_create …" The run: tool steps → result → the divider's "1 spec" chip → the Specs panel updates
spec_types expanded — the registry as the agent sees itEach entry carries What landed on disk (card-driven scaffold, per-type statuses)---
id: decision-use-sqlite
type: decision
status: proposed # validated against the decision card's proposed|accepted|superseded
title: Use SQLite for local storage
---
## Context
## Options considered
## Decision
## ConsequencesThe headings come from the decision card's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


A skills-like system for spec types: users/teams define their own kinds of specs as type cards — one markdown file per type, human-first prose plus a small machine-readable frontmatter core — registered per project and resolved through a registry that agents, tools, and the UI all read.
Design history (approaches considered, prior-art research, decision rounds) lives in the task-spec
.thinkrail/context/TASK-spec-type-system.md(gitignored scratch); the durable decisions are promoted intopackages/spec-graph/SPEC.mdand the touched module specs.What a type card is
.pi/spec-types/*.md(committed, team vocabulary) → (P2) user~/.pi/agent/spec-types/→ seven built-ins: the original five (task-spec= ephemeral) pluscharter(the project's declared stance on specs) anddecision(MADR-shaped ADR).spec_create) with helpful errors; it never influences graph construction or which files are specs. Conformance warnings inspec_validateare recorded for P2.Changes by layer
pi-spec-graph/core## Templateextraction) +SpecTypeRegistry(revalidate-on-read); built-ins embedded as string constants (bundle-safe — core compiles into the binary); frozenSPEC_TYPEStuple removedpi-spec-graph/toolsspec_types(list, or one card in full);spec_createvalidates type + per-card statuses against the registry and scaffolds from the card (Template → sections)SpecGraphSnapshot.types(SpecTypeInfo[]) + scopedspec.saveTypeCard(slug + is-a-card validated server-side; writes only.pi/spec-types/— deliberately not a general fs write)specprojectHasSpecslifecycle-driven (custom ephemeral types can't signal "set up")Where to find it in the UI
Right panel → SPECS tab → scroll to the bottom of the tree → the collapsed "SPEC TYPES (N)" row. Its + button opens the constructor. (Known prototype limitation: the legend scrolls with the tree instead of being pinned — easy to miss on a long graph; candidate P2 polish.)
Specs tab — legend collapsed at the bottom
Legend expanded — the seven built-ins, lifecycle marked
The type constructor — every field hint explains the card schema
Live preview of the exact markdown that will be written
After save —
runbook — PROJECTjoins the registry (SPEC TYPES (8))Ephemeral specs render dimmed/italic in the tree (our own task-spec, dogfooded)
Verification
check:deps·check:seams·lint·typecheck— greenhistory-searchCPU-contention flake, green in isolation, unrelated area)spec.saveTypeCard→.pi/spec-types/runbook.mdon disk → fs-tick refetch → registry shows the new typeRecorded for P2 (not in this PR)
User-local
~/.pi/agent/spec-types/· advisory conformance warnings inspec_validate(incl. near-duplicate-prose detection) · pinned legend + viewer polish · custom link kinds (supersedes) · covers-based drift detection (holds architecture.md's deferral)