From compound-engineering
Systematically explore and document a subsystem for the compound engineering knowledge base
npx claudepluginhub mberto10/mberto-compound<system/subsystem e.g. backend/api or frontend/auth># Subsystem Exploration Command Systematically explore and document a subsystem for the compound engineering knowledge base. --- ## Input Required **System:** $ARGUMENTS (format: `system/subsystem`, e.g., `backend/api` or `frontend/first-value`) If no argument provided, ask the user which subsystem to explore. --- ## Knowledge Location All subsystem specs are stored in the **project root** at `subsystems_knowledge/`. This folder is repo-specific and persists independently of the plugin installation, so each project maintains its own knowledge base. If `subsystems_knowledge/` does...
Systematically explore and document a subsystem for the compound engineering knowledge base.
System: $ARGUMENTS (format: system/subsystem, e.g., backend/api or frontend/first-value)
If no argument provided, ask the user which subsystem to explore.
All subsystem specs are stored in the project root at subsystems_knowledge/. This folder is repo-specific and persists independently of the plugin installation, so each project maintains its own knowledge base.
subsystems_knowledge/
├── backend/
│ ├── workflow.yaml
│ ├── validation.yaml
│ └── ...
├── design-system/
│ └── ...
└── frontend/
└── ...
If subsystems_knowledge/ does not exist yet in this project, create it before proceeding.
Read the project's architecture document (if it exists) to understand:
Check for architecture docs at common locations:
architecture.mddocs/architecture.mdCLAUDE.md (project instructions)Identify the exact files owned by this subsystem.
For Backend/Design System (technical subsystems):
For Frontend (goal-oriented subsystems):
Output: List of owned files with brief purpose annotations.
Inbound (what this subsystem depends on):
Outbound (what depends on this subsystem):
Output: Dependency graph showing subsystem relationships.
Find 3-10 statements that MUST remain true for this subsystem. Look for:
Sources:
Classify each invariant (see references/invariant-checks.md):
check approach.Output: Numbered list of invariants with classification:
1. [MECHANICAL] All route files use requireAuth middleware
Suggested check: grep for requireAuth in all route files
2. [NARRATIVE] User input is sanitized before database queries
3. [MECHANICAL] No direct SQL string concatenation outside repository layer
Suggested check: grep for raw SQL patterns in non-repo files
Against the current milestone, evaluate:
| Aspect | Status | Evidence |
|---|---|---|
| Core functionality works | ||
| Error handling complete | ||
| Happy path tested | ||
| Edge cases handled | ||
| Integration with dependents verified |
Milestone mapping:
Output: Current milestone state with evidence.
Identify concrete starting points that help fresh-context workers navigate the subsystem immediately.
Find the 2-5 most important entry-point files:
index.ts, main.py, __init__.py, etc.)public_api (if identified in Step 2)Find test files colocated with or directly testing the owned files:
tests/ directories matching the subsystem path pattern*.test.*, *.spec.*, *_test.* patterns within or near owned pathsIdentify 1-3 clean, well-structured implementations:
path, when (what kind of work triggers referencing this), pattern (short label)Discover targeted validation commands:
package.json scripts, Makefile, or CI config for subset test/lint commandswhen (what change type) and run (the command)Look for known failure patterns:
recently_fixed entries that suggest recurring patternswhen (trigger context), failure (what goes wrong), mitigation (how to avoid)Based on overall spec completeness after all steps:
List specific items missing to reach the next milestone:
Gaps:
- [ ] GAP-001: [Description] - blocks [functionality]
- [ ] GAP-002: [Description] - blocks [functionality]
Prioritize by:
Output: Prioritized gap list with blocking relationships.
Create or update a YAML spec file at subsystems_knowledge/{system}/{subsystem}.yaml:
id: {subsystem}
system: {system}
owners: []
description: |
Brief description of the subsystem's purpose and responsibility.
architecture:
overview: |
High-level diagram showing how this subsystem fits into the larger system.
components: |
For each major component, show its internal structure.
data_flow: |
Show a complete request/response flow through the subsystem.
paths:
owned:
- {glob patterns}
public_api:
- {exported interfaces}
dependencies:
compile_time: []
runtime: []
data: []
config: []
dependents: []
invariants:
# Mechanical candidates (consider adding check scripts)
- statement: "{invariant — deterministic, checkable}"
check: "# TODO: bash checks/{subsystem}-{check-name}.sh"
# Narrative only (requires judgment)
- "{invariant — requires context or intent understanding}"
tests:
tier0: "{unit test command}"
tier1: "{contract test command}"
tier2: "{integration test command}"
milestone:
current: {concept|prototype|alpha|beta|production}
target: alpha
recently_fixed: []
gaps:
- id: GAP-001
type: {feature|bugfix|optimization}
title: "{title}"
priority: {1-5}
blocks: ["{other gaps or subsystems}"]
done_when: "{acceptance criteria}"
helpful_skills: []
starter_files:
- {entry point file 1}
- {entry point file 2}
adjacent_tests:
- {test file 1}
- {test file 2}
exemplars:
- path: "{clean implementation}"
when: "{what kind of work}"
pattern: "{pattern name}"
common_failure_modes:
- when: "{trigger context}"
failure: "{what goes wrong}"
mitigation: "{how to avoid}"
validation_recipes:
- when: "{change type}"
run: "{command}"
confidence: {high|medium|low}
When creating the architecture section, follow these principles:
Use box-drawing characters for clean visuals:
+ - or unicode- | or unicode--> or unicodeShow decision points where behavior branches
Label data transformations between steps
Include key constraints inline
For complex subsystems, create multiple diagrams:
overview: System integration view{component_name}: Per-component detaildata_flow: End-to-end request traceOutput a markdown summary:
# Subsystem Exploration: {system}/{subsystem}
## Overview
- **Path Pattern:** {paths}
- **Current State:** {milestone}
- **Confidence:** {high|medium|low}
## Key Findings
- {finding 1}
- {finding 2}
## Dependencies
- **Depends on:** {list}
- **Depended on by:** {list}
## Invariants
1. {invariant}
2. {invariant}
## Gaps ({count})
| ID | Title | Priority | Blocks |
|----|-------|----------|--------|
| | | | |
## Worker Anchors
- **Starter files:** {count} identified
- **Adjacent tests:** {count} identified
- **Exemplars:** {count} identified
- **Validation recipes:** {count} identified
- **Common failure modes:** {count} identified
## Recommended Next Steps
1. {step}
2. {step}
If subsystems_knowledge/architecture.yaml does not exist, add to recommended next steps:
- **Bootstrap architecture.yaml** — create `subsystems_knowledge/architecture.yaml` with starter
cross-subsystem invariants (file ownership coverage, dependency graph consistency).
See `references/subsystem-schema.md` "Project-Level Architecture Spec" section.
After exploration, you should have:
subsystems_knowledge/{system}/{subsystem}.yaml specsubsystems_knowledge/ if it doesn't exist