Code to RUP¶
Point the agent at a code base and ask for its documentation. Pro writes the same
documentation set as for a new system, but every statement describes what the code
does, marked observed and cited as path:line. The artifacts carry
origin: code and sourceOfTruth: code.
The procedure¶
- Inventory.
RUP scan --code-root <dir> --writelists the manifests, entry points, entities, services, persistence, contracts and tests, so the agent starts from facts. - Stack and architecture. Identified from manifests and folder layout and recorded in the project configuration document.
- Domain model. Persistence first (schema, migrations, ORM models), then entity classes. One entity per business concept, not per table: join and technical tables are support entities or omitted with a note.
- Levels. The agent asks for the project objective, or infers it from the README and the entry points and marks it assumed, then assigns the levels.
- Use cases. Derived from the entry points: each route, command handler, job, message consumer or CLI command that achieves a user goal. Technical endpoints that serve one goal become one use case.
- Specification. The agent follows the code path of each use case: validation, branching, errors, side effects. The statechart shows only behaviour found in code. A branch that cannot be understood is an open question, not a guess.
- Analysis and design. Classes, sequences, data model and deployment are drawn from the real call graph, the configuration and the deployment files (Dockerfile, compose, CI, infrastructure as code).
- Code map and traceability. Every model element gets its location; the
codecolumn of the traceability table is filled. - Tests. Existing tests fill the
testcolumn; use cases without tests are gaps. - Render, check, review.
Rules the agent follows¶
- It writes behaviour, not intent. Intent that the code does not reveal, such as why a rule exists, is a question.
- Dead code, TODOs and inconsistent behaviour are findings in the audit, not silent fixes in the model.
- It cites
path:lineinstead of pasting code. - It reads files fully before describing them; it never describes from names alone.
- On large code bases it works module by module and keeps a coverage list of what was and was not read.
What you get at the end¶
The files created, the entities and use cases found, the parts not covered and the open questions. Statements it could not support are never presented as facts.