refactor(artifacts): decouple artifact storage via repository pattern#346
Open
JWThewes wants to merge 1 commit into
Open
refactor(artifacts): decouple artifact storage via repository pattern#346JWThewes wants to merge 1 commit into
JWThewes wants to merge 1 commit into
Conversation
fc3e2cf to
30cf518
Compare
WHY
The v2 framework hardcodes "markdown files in a directory tree" across
skills, schemas, and every stage definition. Swapping the storage backend
(e.g. to a graph database) would mean editing dozens of files. We want
storage to be a single, swappable concern — change one adapter, not the
methodology.
HOW
Introduce a port/adapter (repository) pattern:
- Port (conventions/repository-interface.md): a stable, backend-neutral
contract. Artifacts are addressed by a logical TYPE token (e.g.
`requirements`, `components`) — never a filename, extension, or path —
plus a small set of named operations (saveArtifact, readArtifact,
copyForwardArtifact, registerOutput, appendAuditEntry, verifyStage, ...).
- Adapter (src/repository/<backend>/): the ONLY place that knows where and
how artifacts are physically stored. Ships with the `markdown-fs`
backend (adapter + paired verifier). A new backend = one adapter file +
one verifier; nothing else changes.
Operations are a vocabulary of responsibilities, not an API. The adapter
states the mechanism the agent uses to perform them: ordinary file tools for
markdown-fs, or specific tools / an MCP server for other backends (e.g. a
graph DB). The agent always reads the adapter to learn which.
WHAT
- Add port `repository-interface.md` (address model, type catalog, ops).
- Add `repository/markdown-fs/` adapter (absorbs the old folder-structure.md
+ a type->representation map) and `verifier.js` (from process-checker.js,
now resolving the new type/address state format).
- Add `repository/README.md` backend-authoring guide.
- Schemas: state outputs use {type, address} instead of {name,
locationRelativeToIntentRoot}; reword workflow `phase`.
- Rewrite skills (work-method, stage-execution, orchestration, kickoff,
workflow-composition) to speak the port vocabulary; remove "to disk" /
"file system" / `org-ai-kb` leakage from backend-neutral steering.
- Strip extensions to type tokens across all 13 stage definitions and
stage-graph.md.
- build.js: BACKEND selector wires the active adapter -> conventions/ and
verifier -> tools/process-checker.js (Kiro hook path unchanged).
- Remove src/conventions/folder-structure.md and src/tools/process-checker.js
(superseded by the adapter + paired verifier).
Methodology unchanged: stages, personas, state machine, autonomy, and review
loops are untouched — only the storage vocabulary they speak through.
30cf518 to
ee2cef1
Compare
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.
WHY
The v2 framework hardcodes "markdown files in a directory tree" across skills, schemas, and every stage definition. Swapping the storage backend (e.g. to a graph database) would mean editing dozens of files. We want storage to be a single, swappable concern — change one adapter, not the methodology.
HOW
Introduce a port/adapter (repository) pattern:
requirements,components) — never a filename, extension, or path — plus a small set of named operations (saveArtifact, readArtifact, copyForwardArtifact, registerOutput, appendAuditEntry, verifyStage, ...).markdown-fsbackend (adapter + paired verifier). A new backend = one adapter file + one verifier; nothing else changes.Operations are a vocabulary of responsibilities, not an API. The adapter states the mechanism the agent uses to perform them: ordinary file tools for markdown-fs, or specific tools / an MCP server for other backends (e.g. a graph DB). The agent always reads the adapter to learn which.
WHAT
repository-interface.md(address model, type catalog, ops).repository/markdown-fs/adapter (absorbs the old folder-structure.mdverifier.js(from process-checker.js, now resolving the new type/address state format).repository/README.mdbackend-authoring guide.phase.org-ai-kbleakage from backend-neutral steering.Methodology unchanged: stages, personas, state machine, autonomy, and review loops are untouched — only the storage vocabulary they speak through.
Summary
Changes
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Test Plan
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.