Skip to content

feat: implement comprehensive dual-audience documentation system#596

Merged
alexhraber merged 14 commits into
masterfrom
feat/documentation-system
May 26, 2026
Merged

feat: implement comprehensive dual-audience documentation system#596
alexhraber merged 14 commits into
masterfrom
feat/documentation-system

Conversation

@alexhraber
Copy link
Copy Markdown
Contributor

@alexhraber alexhraber commented May 26, 2026

Summary

This PR introduces Decapod's first robust documentation system, optimized for both human operators and AI agents.

Key Advancements

  • Agent-First CLI Helper: Agents can now navigate Decapod's operational contracts and guides directly through the CLI using decapod docs list and decapod docs show. This drastically reduces orientation latency and helps solve the lookup loop described in Issue container_workspace_required remediation is blocked by WORKSPACE_NO_CLAIMED_TODO #568.
  • Automated Environment Updates (init refresh): Added a new quick-start step that sidesteps manual entries to sync config.toml defaults and blend new constitution sections into existing OVERRIDE.md files non-interactively.
  • Auto-Remediation Substrate: By providing deterministic command contracts and error recovery protocols in-binary, this system provides the foundation for auto-remediating agent-induced failures.
  • Human-to-Agent Policy: Humans can explicitly define global rules via .decapod/config.toml and surgical constitution overrides via .decapod/OVERRIDE.md.
  • Automatic Alignment: Documentation is now ingested into the Decapod binary and verified against the implementation via a new test suite (tests/doc_alignment.rs).

Technical Highlights

  • Human Documentation (mdBook): Comprehensive guide in docs/book/ covering mental models and workflows.
  • Agent Orientation Corpus: Machine-optimized API-awareness layer in docs/agent/.
  • In-Binary Ingestion: All documentation is baked into the Decapod binary, ensuring agents always have access to the rules governing their current environment.
  • CI/CD Integration: Automated mdBook deployment and PR-level documentation synchronization.

The docs autoupdate and align with code changes at the PR level, ensuring the control plane's guidance is never out of sync with its capabilities.

- Establish human-facing mdBook in docs/book covering mental model, workflows, and reference.
- Establish agent-facing API orientation corpus in docs/agent for deterministic orientation.
- Update agent entrypoint templates (AGENTS.md, etc.) to mandate API index consultation.
- Align code with documentation: implement container_workspaces configuration and validation.
- Add GitHub Actions workflow for automatic mdBook deployment.
- Update root README with documentation pointers.
Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor Author

@alexhraber alexhraber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address comments

alexhraber added 13 commits May 25, 2026 17:51
- Clean up README.md Quick Start section.
- Implement tests/doc_alignment.rs to verify that documented commands and config keys match the implementation.
- Expose project configuration in 'decapod capabilities --format json' to enable agent discovery and test verification.
- Add 'DecapodProjectConfig::load' and 'discover_repo_root' for cleaner configuration management.
- Update DecapodError with Config variant for better error reporting.
- Update build script to ingest docs/ directory into the embedded constitution graph.
- Update 'decapod docs' command group to separate and display documentation files from constitution sections.
- Shorten agent entrypoints and templates to comply with 120-line validation limit.
- Fix invariant validation failures by using exact phrasing for mandates.
- Relax validation rule for .decapod/ references to allow config.toml mentions in documentation.
- Add 'decapod docs build' command to autogenerate command contracts from CLI structure.
- Implement surgical documentation updates via '--touched' flag.
- Add GitHub Action '.github/workflows/docs_sync.yml' to automatically sync and commit doc changes back to PRs.
- Update PR description with details on agent CLI helper and lookup loop resolution.
- Fix git diff logic in documentation sync workflow to use proper head/base SHAs.
- Make 'decapod docs build' touched files optional to handle empty diffs gracefully.
- Resolve formatting and clippy issues across the codebase.
- Update 'decapod docs build' to correctly handle multiple values for '--touched'.
- Fix 'docs_sync.yml' to fetch origin/master before diffing to avoid 'bad object' errors.
- Add 'refresh' subcommand to 'init' for non-interactive updates of config and overrides.
- Implement 'blend_overrides' logic to merge new constitution sections into existing OVERRIDE.md.
- Update agent entrypoint sequence to: install -> refresh -> ingest -> validate.
- Ensure 'init refresh' is documented in mandatory initialization and safety invariants.
- Update 'decapod init' to automatically refresh environment (blend overrides, sync config) if .decapod exists.
- Addcrates.io version check to 'decapod capabilities' with automatic comparison.
- Implement smart bootstrap logic in entrypoint templates: only install/init if a newer version is available.
- Remove redundant 'init refresh' subcommand.
- Update Safety Invariants to include version-aware gate checks.
- Implement automated environment refresh on 'decapod init' when .decapod exists.
- Sidestep interactive manual entries for existing Decapod projects.
- Preserve legacy entrypoint blending (backups) on initial initialization.
- Integrate crates.io version check into 'decapod capabilities'.
- Implement version-aware 'smart bootstrap' sequence in agent entrypoints.
- Remove unused 'interactive_init_with' function.
@alexhraber alexhraber merged commit 8a33e55 into master May 26, 2026
21 checks passed
@alexhraber alexhraber deleted the feat/documentation-system branch May 26, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant