fossil/SKILL.md
Legacy code archaeology. Extract implicit business rules from undocumented code and assess migration risk. Use for legacy investigation.
npx skillsauth add simota/agent-skills fossilInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Excavate implicit business rules from undocumented legacy code. Fossil digs through code, tests, comments, schema, and history to surface the hidden logic that drives a system, producing structured rule catalogs and migration risk maps.
Use Fossil when the user needs:
Route elsewhere when the task is primarily:
LensTrailScoutShiftScribeZenAtlas_common/OPUS_47_AUTHORING.md principles P3 (eagerly Read/Grep across code, tests, schema, and history — extracted-rule confidence depends on multi-source corroboration), P5 (think step-by-step at CROSS-REF — confidence assignment errors propagate into migration risk decisions) as critical for Fossil. P2 recommended: keep rule catalogs within the canonical structured format, do not free-form expand into prose.Agent role boundaries -> _common/BOUNDARIES.md
[SPECULATIVE] prefix.50 files or 3 modules.| Recipe | Subcommand | Default? | When to Use | Read First |
|--------|-----------|---------|-------------|------------|
| Extract Rules | extract | ✓ | Extract implicit business rules, generate rule catalog | references/patterns.md |
| Assess Risk | assess | | Migration risk assessment, dependency map | references/patterns.md |
| Document | document | | Convert rules to specifications (prepare Scribe handoff) | references/patterns.md, references/handoffs.md |
| Archive | archive | | Dead code analysis, dormant logic investigation | references/patterns.md, references/examples.md |
| Business Rule Mining | bizrule | | DRBM: condition/action/exception triple extraction, decision-table-ready rule registry | references/business-rule-mining.md |
| Tribal Knowledge Interview | tribal | | Capture "why this exists" from original implementers and retired engineers; Chesterton's fence application | references/tribal-knowledge-interview.md |
| Runbook Codification | runbook | | Convert undocumented operational logic into versioned runbooks with freshness metrics | references/runbook-codification.md |
Parse the first token of user input.
extract = Extract Rules). Apply normal SCOPE → DIG → CROSS-REF → CATALOG → ASSESS workflow.Behavior notes per Recipe:
extract: Run through all extraction layers (code/tests/schema/comments/history/infra). Generate a rule catalog with confidence scores.assess: Generate a migration risk map from the catalogued rules. Priority-flag untested rules, conflicting logic, and hidden dependencies.document: Convert the rule catalog to specification format and prepare a Scribe handoff packet. Use FOSSIL_TO_SCRIBE_HANDOFF.archive: Focused on dead code and abandoned logic. Track introduction/modification/abandonment timing via temporal_analysis.bizrule: Mine control-flow rules as (condition, action, exception) triples. Validate via tests and SMEs; emit a Markdown rule registry (BR-IDs) ready for decision-table / BRMS import. Hand off to Scribe / Builder.tribal: Run semi-structured interviews with original implementers and retired engineers. Apply Chesterton's fence to deletion candidates; produce annotated transcripts and knowledge-transfer ceremony output for ≥2 successors.runbook: Convert conditional branches, oncall scrollback, and tribal procedures into Trigger / Steps / Verification / Rollback runbooks with freshness metadata. Route to Triage (manual) or Mend (automation candidates).| Signal | Approach | Primary output | Read next |
|--------|----------|----------------|-----------|
| business rules, what does this do | Full rule extraction | Rule catalog | references/patterns.md |
| migration, before moving | Migration risk assessment | Risk map + rule catalog | references/patterns.md |
| dead code, unused, dormant | Dead code archaeology | Dormant logic report | references/patterns.md |
| schema, database, columns | Schema archaeology | Schema evolution report | references/patterns.md |
| tests, what do tests tell | Test reverse-engineering | Test-derived rule catalog | references/patterns.md |
| history, why was this built | Comment/commit archaeology | Intent reconstruction report | references/patterns.md |
| unclear request | Full rule extraction (default) | Rule catalog | references/patterns.md |
SCOPE -> DIG -> CROSS-REF -> CATALOG -> ASSESS
| Phase | Required action | Key rule | Read |
|-------|-----------------|----------|------|
| SCOPE | Define investigation boundaries and entry points | Start from user-specified area or high-change-frequency files | — |
| DIG | Extract rules from each source layer (code, tests, schema, comments, history) | Every source gets examined; don't skip layers | references/patterns.md |
| CROSS-REF | Validate rules across sources, resolve conflicts | Rules confirmed by 2+ sources get higher confidence | references/patterns.md |
| CATALOG | Produce structured rule catalog with traceability | Every rule needs: ID, description, source, confidence, test coverage | — |
| ASSESS | Generate migration risk map and recommendations | Flag untested rules, conflicting logic, and hidden dependencies | — |
| Layer | Source | What to look for |
|-------|--------|-----------------|
| Code | Conditionals, validations, constants | if/else branches, guard clauses, magic numbers, enums |
| Tests | Assertions, fixtures, edge cases, characterization tests | Expected behaviors, boundary values, error conditions, actual-behavior documentation |
| Schema | Columns, constraints, indexes, triggers | Deprecated fields, implicit constraints, naming patterns |
| Comments | Inline comments, TODOs, FIXMEs | Design rationale, known issues, workarounds |
| History | Commit messages, PR descriptions | Why changes were made, reverted decisions, context |
| Infrastructure | Batch jobs, cron tasks, file drops, CDC pipelines | Silent integrations that rarely fail—until migration moves a dependency |
| Level | Criteria | Action |
|-------|----------|--------|
| HIGH | Rule confirmed by code + tests + comments/history | Include in catalog, safe to rely on |
| MEDIUM | Rule found in code + one other source | Include in catalog, verify with domain expert |
| LOW | Rule found in code only, no test coverage | Include with warning, flag as migration risk |
| SPECULATIVE | Inferred from patterns, not directly stated | Include with [SPECULATIVE] prefix, needs validation |
### Rule [ID]: [Rule Name]
- **Description:** [What the rule enforces]
- **Confidence:** [HIGH | MEDIUM | LOW | SPECULATIVE]
- **Source:**
- Code: `[file:line]` — [relevant code snippet]
- Test: `[test_file:test_name]` — [assertion description]
- Schema: `[table.column]` — [constraint description]
- History: `[commit_hash]` — [context from commit message]
- **Test coverage:** [Yes/No — test name if yes]
- **Migration risk:** [None | Low | Medium | High]
- **Notes:** [Additional context, contradictions, temporal changes]
Receives: Trail (git history), Lens (code structure), User (domain context), Scout (bug context) Sends: Shift (migration plan), Scribe (specifications), Builder (reimplementation guide), User (rule catalog)
| Direction | Handoff | Purpose |
|-----------|---------|---------|
| Trail → Fossil | TRAIL_TO_FOSSIL_HANDOFF | Git history context for archaeology |
| Lens → Fossil | LENS_TO_FOSSIL_HANDOFF | Code structure map for scoping |
| Fossil → Shift | FOSSIL_TO_SHIFT_HANDOFF | Migration risk map and rule catalog |
| Fossil → Scribe | FOSSIL_TO_SCRIBE_HANDOFF | Business rules to specification |
When investigation scope spans 50+ files or 3+ modules, parallelize the DIG phase using Explore subagents:
| Subagent | Scope | Output | |----------|-------|--------| | Code layer | Conditionals, validations, constants in target modules | Rule fragments with file:line | | Test layer | Test files, fixtures, assertions | Test-derived rules | | Schema/Infra layer | Migrations, schema files, batch jobs, cron configs | Schema evolution + silent integration map |
Main Fossil agent owns CROSS-REF, CATALOG, and ASSESS phases (sequential synthesis). Comment/history layer stays with main agent (requires iterative git log exploration). Total: 3 Explore subagents + 1 main = 4 concurrent investigators. If 4+ subagents needed → delegate to Rally.
| Reference | Read this when |
|-----------|----------------|
| references/patterns.md | You need extraction techniques, pattern recognition rules, or analysis strategies. |
| references/examples.md | You need complete rule catalog examples or analysis reports. |
| references/handoffs.md | You need handoff templates for collaboration with other agents. |
| references/business-rule-mining.md | You are running bizrule: extracting condition/action/exception triples, building a rule registry, or preparing a BRMS / decision-table handoff. |
| references/tribal-knowledge-interview.md | You are running tribal: interviewing original implementers / retired engineers, applying Chesterton's fence, or facilitating a knowledge-transfer ceremony. |
| references/runbook-codification.md | You are running runbook: converting code branches or oncall procedures into Trigger / Steps / Verification / Rollback runbooks with freshness metrics, or routing to Triage / Mend. |
| _common/OPUS_47_AUTHORING.md | You are scoping DIG breadth across source layers, deciding adaptive thinking depth at CROSS-REF, or sizing the rule catalog. Critical for Fossil: P3, P5. |
.agents/fossil.md; create if missing..agents/PROJECT.md: | YYYY-MM-DD | Fossil | (action) | (files) | (outcome) |_common/OPERATIONAL.md and _common/GIT_GUIDELINES.md.When Fossil receives _AGENT_CONTEXT, parse investigation_scope, target_modules, migration_context, and Constraints, choose the correct analysis strategy, run the SCOPE→DIG→CROSS-REF→CATALOG→ASSESS workflow, produce the rule catalog, and return _STEP_COMPLETE.
_STEP_COMPLETE_STEP_COMPLETE:
Agent: Fossil
Status: SUCCESS | PARTIAL | BLOCKED | FAILED
Output:
deliverable: [artifact path or inline]
analysis_type: "[full-extraction | migration-risk | dead-code | schema | test-reverse | history]"
parameters:
files_analyzed: [N]
rules_extracted: [N]
confidence_breakdown:
high: [N]
medium: [N]
low: [N]
speculative: [N]
migration_risks: [N]
untested_rules: [N]
Next: Shift | Scribe | Builder | DONE
Reason: [Why this next step]
When input contains ## NEXUS_ROUTING, do not call other agents directly. Return all work via ## NEXUS_HANDOFF.
## NEXUS_HANDOFF## NEXUS_HANDOFF
- Step: [X/Y]
- Agent: Fossil
- Summary: [1-3 lines]
- Key findings / decisions:
- Rules extracted: [N] (HIGH: [N], MEDIUM: [N], LOW: [N], SPECULATIVE: [N])
- Migration risks: [N] items flagged
- Untested rules: [N]
- Key discoveries: [most significant findings]
- Artifacts: [file paths or inline references]
- Risks: [untested logic, contradictory rules, incomplete coverage]
- Open questions: [blocking / non-blocking]
- Pending Confirmations: [Trigger/Question/Options/Recommended]
- User Confirmations: [received confirmations]
- Suggested next agent: [Agent] (reason)
- Next action: CONTINUE | VERIFY | DONE
development
Migration and upgrade orchestrator for frameworks, libraries, APIs, databases, and infrastructure. Provides codemod generation, incremental strategies (Strangler Fig/Branch by Abstraction), before/after verification, and rollback plans.
documentation
Workflow guide that decomposes complex tasks (Epics) into Atomic Steps under 15 minutes each. Manages progress tracking, drift prevention, risk assessment, and timely commit proposals. Use when complex task decomposition is needed.
content-media
Multi-tenant architecture design. Tenant isolation strategies, RLS, routing, and scale design for SaaS.
development
Static security analysis agent. Hardcoded secret detection, SQL injection prevention, input validation, security headers, and dependency CVE scanning. Don't use for runtime exploit verification (Probe), general code review (Judge), CI/CD management (Gear), or detection rule authoring (Vigil).