| name | reverse |
| scope | partial |
| description | [UDS] System archeology - reverse engineer code across Logic, Data, and Runtime dimensions |
| allowed-tools | Read, Grep, Glob, Bash(pg_dump:*), Bash(mysql:*), Bash(sqlite3:*), Bash(npm run:*), Bash(cat:*), Bash(docker:*) |
| argument-hint | [spec|data|runtime|bdd|tdd] <input> |
| disable-model-invocation | true |
Reverse Engineering Assistant | ๅๅๅทฅ็จๅฉๆ
System archeology framework: reverse engineer existing systems across three dimensions โ Logic, Data, and Runtime.
็ณป็ตฑ่ๅคๆกๆถ๏ผๅพไธๅ็ถญๅบฆๅๅๅทฅ็จๆขๆ็ณป็ตฑโโ้่ผฏใ่ณๆใๅท่ก็ฐๅขใ
Three Dimensions | ไธๅคง็ถญๅบฆ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ System Archeology Framework โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Logic โ Data โ Runtime โ
โ (spec) โ (data) โ (runtime) โ
โโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ APIs โ DB Schemas โ Logs & Error Patterns โ
โ Modules โ ORMs/Models โ Config & Environment โ
โ Flows โ Migrations โ Metrics & Performance โ
โ Tests โ Seed Data โ Infra & Deployment โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Subcommands | ๅญๅฝไปค
| Subcommand | Dimension | Input | Output | ่ชชๆ |
|---|
| (none) | All | Project root | Full Archeology Report | ไธ็ถญๅบฆๅ
จ้ขๅๆ |
spec | Logic | Code files/dirs | SPEC-XXX.md | ๅพ็จๅผ็ขผๆๅ่ฆๆ ผ |
data | Data | DB schemas, ORMs, migrations | Data Model Spec | ๅๆ่ณๆๆจกๅ่็ตๆง |
runtime | Runtime | Logs, configs, metrics | Runtime Baseline | ๅๆๅท่ก็ฐๅขๅบๆบ |
bdd | โ | SPEC-XXX.md | .feature | ๅฐ AC ่ฝ็บ Gherkin |
tdd | โ | .feature | Coverage Report | ๅๆๆธฌ่ฉฆ่ฆ่็ |
Full Analysis Mode | ๅ
จ้ขๅๆๆจกๅผ
When /reverse is invoked without a subcommand, execute all three dimensions sequentially:
- Data โ Scan schemas, ORMs, migrations
- Runtime โ Analyze logs, configs, deployment
- Logic (spec) โ Extract APIs, flows, tests โ Generate SPEC
Output: Integrated System Archeology Report combining all three dimensions.
Dimension Details | ็ถญๅบฆ่ฉณๆ
spec: Logic Dimension (ๆขๆ)
- Scan - Read source files and identify public APIs, data flows, and business logic
- Classify - Tag each finding as
[Confirmed], [Inferred], or [Unknown]
- Structure - Organize into SDD spec format with Acceptance Criteria
- Attribute - Cite every reversed item with
file:line source reference
data: Data Dimension (ๆฐๅข)
- Discover - Find database schemas, ORM models, migration files, seed data
- Map - Build entity-relationship model from code evidence
- Classify - Tag relationships as
[Confirmed] (FK constraints) or [Inferred] (code patterns)
- Report - Output data model spec with:
- Entity list with fields and types
- Relationship map (1:1, 1:N, M:N)
- Index and constraint inventory
- Migration history summary
- Data flow paths (write โ read)
Evidence sources: schema.prisma, *.migration.*, models/, entities/, knexfile.*, sequelize, typeorm, SQL files, docker-compose.yml (DB services)
runtime: Runtime Dimension (ๆฐๅข)
- Scan configs - Environment variables, config files, feature flags
- Analyze logs - Log patterns, error frequency, log levels
- Check infra - Docker configs, CI/CD pipelines, deployment manifests
- Baseline - Output runtime baseline with:
- Environment variable inventory (names only, never values/secrets)
- Config file map and hierarchy
- External service dependencies (APIs, queues, caches)
- Deployment topology (containers, services)
- Health check and monitoring endpoints
Evidence sources: .env.example, docker-compose.yml, Dockerfile, *.config.*, CI/CD files, k8s/, log files (patterns only)
Security: NEVER output actual secret values. Only list variable names and describe their purpose.
Anti-Hallucination Rules | ้ฒๅนป่ฆบ่ฆๅ
| Rule | Requirement | ่ฆๆฑ |
|---|
| Certainty Tags | Use [Confirmed], [Inferred], [Unknown] for all findings | ๆๆ็ผ็พ้ ๆจๆณจ็ขบๅฎๆง |
| Source Attribution | Cite file:line for every reversed item | ๆฏ้
ๅๅ็ตๆ้ ๅผ็จไพๆบ |
| No Fabrication | Never invent APIs or behaviors not found in code | ไธๅพๆ้ ็จๅผ็ขผไธญไธๅญๅจ็ API ๆ่ก็บ |
| No Secrets | Never output secret values from configs or env files | ไธๅพ่ผธๅบ่จญๅฎๆชๆ็ฐๅข่ฎๆธ็ๅฏ้ฐๅผ |
Usage | ไฝฟ็จๆนๅผ
/reverse - Full 3-dimension analysis | ไธ็ถญๅบฆๅ
จ้ขๅๆ
/reverse spec src/auth/ - Logic: extract spec | ้่ผฏ๏ผๆๅ่ฆๆ ผ
/reverse data - Data: analyze schemas & models | ่ณๆ๏ผๅๆ็ตๆง
/reverse runtime - Runtime: analyze configs & infra | ๅท่ก็ฐๅข๏ผๅๆ้
็ฝฎ
/reverse bdd specs/SPEC-AUTH.md - Convert spec ACs to Gherkin
/reverse tdd features/auth.feature - Analyze test coverage
Next Steps Guidance | ไธไธๆญฅๅผๅฐ
After /reverse (full or spec) completes, the AI assistant should suggest:
็ณป็ตฑ่ๅคๅฎๆใๅปบ่ญฐไธไธๆญฅ / System archeology complete. Suggested next steps:
- ๅท่ก
/sdd ๅฏฉๆฅไธฆๆ ธๅๆญค่ฆๆ ผ โญ Recommended / ๆจ่ฆ โ Review and approve the generated spec
- ๅท่ก
/derive ๅพ่ฆๆ ผๆจๅฐๆธฌ่ฉฆ โ Derive tests from spec (requires approval first)
- ๅฏฉๆฅ่ฆๆ ผไธญ็
[Inferred] ๅ [Unknown] ๆจ่จ โ Review uncertainty tags manually
Reference | ๅ่
AI Agent Behavior | AI ไปฃ็่ก็บ
ๅฎๆด็ AI ่ก็บๅฎ็พฉ่ซๅ้ฑๅฐๆ็ๅฝไปคๆไปถ๏ผ/reverse
For complete AI agent behavior definition, see the corresponding command file: /reverse