/mainframe-cobol-db2:cobol-db2-loop phase=archaeology|vision|architecture|implementation|quality|operations [slice=<NNN-slug>]from mainframe-cobol-db2
Runs COBOL/DB2 modernization phases as bounded correction loops with observable exit gates, iteration ledger, and engineering graph extracted from COBOL, copybooks, JCL, and DB2 DDL.
Ships in mainframe-cobol-db2. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Run one COBOL/DB2 phase as a bounded loop: produce, check against an observable gate, correct or escalate, and record iteration evidence. Close a phase only when its gate passes on actual checks, and keep the engineering graph as the shared coverage artifact every phase reads and extends.
Use $ARGUMENTS to select phase and an optional slice. Accept only the six phase names in the argument hint. When phase is absent, infer it from artifacts that exist in the target repository and confirm the inference before acting. When slice is absent, evaluate the gate over every node and label the result unscoped. Never create a branch, issue, or pull request from an inferred phase.
| Loop | Scope | Ends when |
|---|---|---|
| Inner | One phase, one slice | The phase gate passes on actual checks, not on produced volume. |
| Outer | Across phases | A defect is routed to the phase that owns its root cause and that phase's inner loop closes again. |
| Improvement | One closed slice | Improvement candidates are recorded with an owner and applied to the next slice. |
Each inner iteration follows produce -> check -> classify -> correct -> recheck. Binding rules:
not-run, never as pass.| Loop | Gate in one line | Graph gate |
|---|---|---|
archaeology | Every recognized corpus file is mapped and every rule candidate derives from inspected evidence. | archaeology |
vision | No rule candidate is left undecided; each has an owner or a note. | vision |
architecture | Every requirement has a valid source and every binding choice has a decision record. | architecture |
implementation | Every in-scope requirement has code and a passing focused check. | implementation |
quality | Every requirement is verified, and every DB2 table and VSAM dataset has a migration mapping. | quality |
operations | Delivery, infrastructure, approval, and documentation evidence exists for the slice. | operations |
Archaeology has one criterion the other phases do not: extraction must cover the whole corpus. Compare
extraction.recognizedFiles with the corpus inventory and answer or accept every unresolved note. A deep
reading of one program proves nothing about the programs nobody opened.
Route by root cause, not by the phase that observed the symptom.
| Symptom | Root cause layer | Owning phase |
|---|---|---|
| Test asserts behavior the legacy system never had | Misread legacy evidence | archaeology |
| Rule was implemented but nobody wanted it | Unowned or unprioritized scope | vision |
| Requirement is ambiguous, untestable, or has two behaviors | Requirement form or missing decision | architecture |
| Code diverges from an approved, unambiguous requirement | Implementation defect | implementation |
| Behavior matches but data does not reconcile | Migration mapping or oracle defect | quality |
| Behavior is correct but not deployable, observable, or documented | Delivery or documentation gap | operations |
A gate result is evidence. A gate decision is authority. The loop computes the first and never claims the second.
These never close autonomously: scope acceptance, requirement approval, binding technical decisions, accepted deviations, slice re-scoping, budget-exhaustion escalation, reconciliation sign-off, legacy source writes, external mutations, merges, and deployments. Prepare the material, recommend an answer with evidence, then stop and report.
Everything read-only, local, or reversible runs unattended: reading legacy evidence, extracting and querying the graph, running builds and tests, writing the slice folder, and drafting issues, runbooks, and decision records for review.
One JSON document links COBOL programs, copybooks, JCL, DB2 tables, cursors, VSAM datasets, business rules, requirements, target code, tests, and delivery. Each phase adds nodes and edges; each gate is a query over the same document.
python3 scripts/cobol_db2_graph.py extract --corpus <legacy-root> --slice <NNN-slug> --out <graph.json>
python3 scripts/cobol_db2_graph.py extract --corpus <legacy-root> --merge <graph.json> --out <graph.json>
python3 scripts/cobol_db2_graph.py validate --graph <graph.json>
python3 scripts/cobol_db2_graph.py gate --graph <graph.json> --phase quality --slice <NNN-slug>
python3 scripts/cobol_db2_graph.py query --graph <graph.json> --query slice-order
The extractor emits only the legacy layer: members, CALL with a literal target, COPY, JCL EXEC PGM
and procedure inclusion, CREATE TABLE definitions, cursor declarations, SELECT clauses, and dataset
ASSIGN clauses. Anything it cannot cite becomes an unresolved note, never a node: a dynamic CALL by
identifier, a target absent from the corpus, and a duplicate member name. Comments are stripped before
matching, so a commented-out CALL or a //* JCL line produces no edge. Business rules, requirements,
decisions, and target nodes stay authored by humans, so the archaeology gate still needs a person.
--merge adds only what is missing and never overwrites an authored node.
Column-level DDL content is not extracted: CREATE TABLE bodies and copybook layouts vary too much to
parse without inventing structure. Use cobol-db2-analysis to read them and db2-postgresql-migration
to map them.
scripts/cobol_db2_graph.py: read-only extractor, graph validator, gate evaluator, and query engine.scripts/test_cobol_db2_graph.py: tests for extraction, comment handling, dynamic calls, validation, gates, slice order, and merge safety.cobol-db2-context for corpus layout, evidence precedence, and stack boundaries.cobol-db2-analysis to read source structure and db2-postgresql-migration to map data.## COBOL/DB2 loop result
**Phase:** archaeology | vision | architecture | implementation | quality | operations
**Slice:** <NNN-slug or unscoped>
**Status:** closed | iterating | escalated | blocked | paused-for-human
**Iterations:** <used>/3
### Gate
| Criterion | Result | Evidence or blocker |
| --- | --- | --- |
### Iterations
| # | Change | Check run | Actual result |
| --- | --- | --- | --- |
### Routed defects
| Defect | Root cause layer | Owning phase | Owner |
| --- | --- | --- | --- |
### Improvements and residual risk
- <candidate or risk, owner, next checkpoint>
not-run.extraction.recognizedFiles with the corpus inventory.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin mainframe-cobol-db215 skills in this plugin
/cobol-db2-analysisAnalyze COBOL programs, copybooks, PERFORM and CALL structure, file and VSAM access, embedded EXEC SQL and EXEC CICS, DB2 DDL, DCLGEN structures, cursors, and JCL job steps with source citations. Use when reading or inventorying a COBOL/DB2 legacy system before modernization./cobol-db2-contextSupply COBOL, DB2, VSAM, and JCL modernization context: corpus layout, member conventions, target stack boundaries, evidence precedence, stage flow, and security rules. Use when starting any COBOL/DB2 modernization task, before analysis, design, implementation, verification, or delivery./Other plugins' skills for the same job