Skill definition
hi-document-lifecycle
Orchestrates evidence-backed document generation, human clarification, semantic/diagram refinement, and conditional review-comment resolution with pause/resume for one scoped domain. Use hi-maintenance-docs for a complete multi-domain pack.
SKILL.md
Document Lifecycle
Read shared/orchestrator-contract.md. Own the run root, checkpoint, revision ledger, pauses, joins, current/ materialization, and final status. Never invoke another orchestrator; leaves never update global lifecycle state.
Inputs
Required: repo_root, one document domain, bounded scope/anchor, output_root, source revision, visibility, review_required. Optional: prerequisite manifests, project/database/collection identity, output modes, clarification answers, review comments, limits, resume checkpoint.
Read lifecycle-contract.md, transition-contract.md, document-lifecycle-manifest.schema.json, and diagram-render-result.schema.json before starting.
Generator Routing
| Domain | Generator | Optional Prerequisites |
|---|---|---|
| system/module summary | hi-module-summary-report | hi-repo-recon, hi-tech-build-audit |
| use case | hi-usecase-discovery | hi-repo-recon |
| technical behavior | hi-behavior-modeling | use-case or entry-point anchor |
| API/event contract | hi-api-contract-discovery | module/endpoint inventory |
| data model | hi-data-model-discovery | persistence/module inventory |
| command/protocol spec | hi-command-spec-discovery | module/command anchor |
Select exactly one generator per scoped lifecycle run.
Three Phases
Phase 1: Generate
- Validate repository identity, output boundary, domain, review policy, source revision, and resume hashes.
- Create
document-lifecycle/<run-id>/with isolated stage roots, checkpoint, empty revision ledger, and root-owned manifest. - Run prerequisite leaves only when required validated inputs are absent.
- Run selected generator leaf. Join local manifest as immutable
r001-generate.
Phase 2: Clarify/Refine
- Run
hi-document-refinementanalyzeagainstr001. If blocking questions lack answers → persistwaiting_for_inputand stop with resume state. - On resume, validate answers and run
applymode. Join accepted candidate asr002-refine; defer unanswered non-blocking items as gaps.
Phase 3: Review/Update
- If comments absent and review optional →
skipped_no_comments. If review required and no comments →waiting_for_input. Otherwise runhi-document-review-resolutionagainst base revision. - Join accepted changes as
r003-review; reject stale, invalid, or unresolved blocking changes. - Revalidate changed dependencies, links, diagrams, redaction, evidence, hashes, and publication gate.
- Atomically materialize accepted revision under
current/; persist final status.
Completion
Complete when: all transitions are legal, revisions have valid lineage and hashes, blocking items are resolved or deferred as gaps, every comment has one disposition, human inputs retain non-code provenance, navigation stays inside run root, and public visibility has explicit approval.
Continue exploring