Plugin Workflow

August 12, 2026 · View on GitHub

Module: scripts/, commands/, skills/, hooks/ Entry: /docflow:check, /docflow:doctor, /docflow:init, /docflow:adopt, /docflow:repair

Architecture

LayerFilesRole
Bash backendscripts/docflow-*.sh, scaffold.sh, check-links.shShared implementation for all agents
Claude UXcommands/docflow-*.md, .claude-plugin/plugin.jsonSlash commands and SessionStart hook
Codex UX.codex-plugin/plugin.json, skills/docs-*Skills and plugin manifest
Portable repo UXrepo-templates/AGENTS.md, GEMINI.md, .cursorrulesAgent guidance committed into target repos
Docs templatestemplates/Source skeletons copied during init/adopt
Browser portaltemplates/index.htmlStatic docs reader generated into scaffolded repos

Flow

CommandMutationBehavior
checknoneSummarizes readiness as ready, needs setup, needs adoption, needs repair, or blocked
doctornoneScans config, docs roots, guidance files, changelog months, helpers, placeholders, and links
initsafe create-onlyRuns doctor first; scaffolds only when no meaningful docs exist
adoptsafe create-onlyAdds missing docflow infrastructure around existing docs; writes an adoption review
repairgenerated/helper onlyRegenerates INDEX.md, installs missing helpers, reports links/placeholders
validatenoneChecks docs readiness and exits non-zero when blocking errors exist
feature-plancontent docUses the user's message as a source brief, then creates or merges a dated plans/features/ status doc
product-speccontent docUses a brief or code path as evidence, then creates or merges product-spec/ WHAT docs with TBD for unclear product facts
docs portalstatic UIReads INDEX.md, groups docs by folder, filters entries, and renders Markdown client-side
context hooknonePrints docs map and newest filename-sorted changelog month; exits 0

Data and Config

FileContract
docflow.jsondocsRoot and changelogDir; parsed with grep/sed, not jq
docs/INDEX.mdGenerated path-to-purpose map from first H1 in each Markdown file
changelog monthFilename mmm-yy.md or (mmm-yy).md; hook sorts by filename date, not mtime
root guidanceAGENTS.md, GEMINI.md, .cursorrules point agents at docs and changelog

API

CommandContract
scripts/docflow-check.sh --target <repo> [--docs-root docs]Prints one readiness status and exact next command; exits 0 only when ready
scripts/docflow-validate.sh --target <repo> [--docs-root docs]Prints status, errors, and warnings; exits 1 only when validation errors exist
/docflow:validateClaude command wrapper around the validation script
validateCodex skill wrapper around the validation script

Safety Rules

  • Existing files are skipped, not overwritten.
  • Placeholder replacement only runs on files created during the current scaffold.
  • Doctor is read-only and exits 0 for normal repo states.
  • Validate is read-only and exits non-zero only for objective blockers.
  • Hook is read-only, token-light, and exits 0 on every path.
  • Repair only mutates generated/helper files.

Update Log

DateChangeRef
2026-06-14Added validation gate command and read-only contract.docflow-validate
2026-06-14Added one-screen readiness check for usability.docflow-check
2026-08-12Repair now upgrades managed helpers; adoption selects compatibility-aware validation and context loads bounded changelog sections.adoption-aware-validation

Risks

RiskMitigation
Existing docs are messyDoctor recommends adopt; adopt preserves all existing content
Old changelog file touched recentlyHook sorts by encoded filename date instead of mtime
Broken links from parenthesized filenamescheck-links.sh supports angle-wrapped Markdown links
Agent install differs by platformScripts remain the common backend; commands/skills are wrappers

Related: