Overview
Ship structured-content as a Claude Code plugin — a structured, installable package that enables AI-assisted authoring and validation workflows for spaces.
Claude Code plugins can include:
- Skills — reusable agent skills (we already ship one in
skills/structured-context/)
- Rules — project-level guidance for Claude on how to work with spaces
- Commands — slash commands that users can invoke directly in Claude Code
- Hooks — shell commands that fire on Claude Code events (e.g. before/after file edits)
Core idea: file-level validation via hooks
The most compelling use case is automatic validation on file save. If we add a validate-file command that accepts a path and resolves the space it belongs to, we can wire it into Claude Code's PostToolUse hook (fires after Write, Edit, MultiEdit) to:
- Detect if the edited file belongs to a known space
- Run validation against that file (and any nodes it references)
- Surface errors back to the agent so it can self-correct
This closes a tight feedback loop: the agent edits → hook validates → errors flow back → agent fixes, without the user needing to manually run sctx validate.
A PreToolUse hook (fires before Write, Edit, MultiEdit) provides a baseline: the agent sees which errors already existed before its edit. This prevents it from trying to fix pre-existing issues that aren't its responsibility — it should only be accountable for errors it introduced.
Scoped validation (analogous to lint-on-changed-files)
Full space validation after every edit is expensive and noisy. The hook use case calls for scoped validation — running only against the file(s) touched by an edit, similar to how linters run over changed files only in a coding workflow.
This raises design questions to work through:
- A single edited
.md file may be one node, but validation errors can involve related nodes (e.g. a broken wikilink affects the referencing file, not the target). What's the right scope?
- The pre-edit baseline needs to use the same scope as the post-edit check so the diff is meaningful.
- Consider:
validate-file <path> validates the file plus any nodes that reference it or that it references (1-hop neighbourhood), rather than the full space.
Ideas to capture (to be broken down)
References
Overview
Ship structured-content as a Claude Code plugin — a structured, installable package that enables AI-assisted authoring and validation workflows for spaces.
Claude Code plugins can include:
skills/structured-context/)Core idea: file-level validation via hooks
The most compelling use case is automatic validation on file save. If we add a
validate-filecommand that accepts a path and resolves the space it belongs to, we can wire it into Claude Code's PostToolUse hook (fires afterWrite,Edit,MultiEdit) to:This closes a tight feedback loop: the agent edits → hook validates → errors flow back → agent fixes, without the user needing to manually run
sctx validate.A PreToolUse hook (fires before
Write,Edit,MultiEdit) provides a baseline: the agent sees which errors already existed before its edit. This prevents it from trying to fix pre-existing issues that aren't its responsibility — it should only be accountable for errors it introduced.Scoped validation (analogous to lint-on-changed-files)
Full space validation after every edit is expensive and noisy. The hook use case calls for scoped validation — running only against the file(s) touched by an edit, similar to how linters run over changed files only in a coding workflow.
This raises design questions to work through:
.mdfile may be one node, but validation errors can involve related nodes (e.g. a broken wikilink affects the referencing file, not the target). What's the right scope?validate-file <path>validates the file plus any nodes that reference it or that it references (1-hop neighbourhood), rather than the full space.Ideas to capture (to be broken down)
validate-file <path>CLI command — resolves space from path, validates single file, machine-readable outputbunx structured-content) so consumer repos don't configure manually/validate,/dump-node)skills/structured-context/skill folded into plugin as canonical sourceReferences
claudeentry inpackage.json