cd /news/artificial-intelligence/best-prompt-agent-workflow-to-recons… · home › topics › artificial-intelligence › article
[ARTICLE · art-173228] src=discuss.huggingface.co ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

Best prompt / agent workflow to reconstruct a complete legacy ERP knowledge base from source code

A practitioner seeking to reconstruct a complete knowledge base from a decades-old IBM i (AS400) ERP — spanning RPG III, RPG IV/RPGLE, CLP/CLLE, DDS, SQLRPGLE, DB2 for i and batch jobs — was advised to extract the system's dependency map before prompting, rather than search for a single ideal prompt. The recommended approach uses DSPPGMREF with OUTPUT(*OUTFILE) to list the files and programs each program references as recorded at compile time, and DSPDBR to show which files depend on each physical file, loading both into a graph; calls through a variable program name will not resolve in DSPPGMREF. The workflow then proceeds bottom-up, with the model summarizing leaf programs first and each higher summary reading its own source plus the summaries below it, requiring a citation of the member and line for every business rule so retiring experts can verify each rule quickly.

recommendation

Extract program-to-file references with DSPPGMREF OUTPUT(*OUTFILE) and file dependencies with DSPDBR into a graph, then summarize leaf programs bottom-up and require a member-and-line citation for every business rule.

more in playbook: Retrieval and RAG
read1 min views7 publishedNov 20, 2026
Best prompt / agent workflow to reconstruct a complete legacy ERP knowledge base from source code
Image: Discuss (auto-discovered)
Hello,

I am working on a large IBM i (AS400) ERP containing:
  • RPG III
  • RPG IV / RPGLE
  • CLP / CLLE
  • DDS
  • SQLRPGLE
  • DB2 for i
  • Batch jobs
  • Several decades of accumulated business logic

My objective is NOT code explanation.

My objective is to reconstruct the complete knowledge of the ERP, including:

  • business processes
  • business rules
  • application architecture
  • dependencies
  • workflows
  • hidden knowledge
  • impact analysis
  • functional cartography

Ideally, I would like an AI agent capable of progressively building and refining a knowledge base while analyzing additional source code.

I am looking for advice regarding:

  1. The best prompting strategy for Claude Opus / Sonnet.
  2. The best open-source models available on Hugging Face.
  3. Agentic architectures (LangGraph, CrewAI, OpenHands, etc.).
  4. Knowledge graph approaches.
  5. RAG architectures for large legacy codebases.
  6. Reverse-engineering workflows used successfully in the industry.

If you had to design the ultimate prompt to reconstruct the knowledge of retiring experts from a legacy ERP, what would it look like? Thank you.

I wouldn’t look for one perfect prompt. On code this size, a model guesses at links it can’t see. So get the map from the system first.

DSPPGMREF with OUTPUT(*OUTFILE) lists the files and programs each of your programs refers to, as recorded at compile time. I think calls through a variable program name won’t resolve there. DSPDBR shows which files depend on each physical file, and you can load both into a graph.

Then go bottom-up. The model sums up your leaf programs first, and each higher summary reads its own source plus the summaries below it. Ask it to cite the member and line for each business rule, so your retiring experts can check every rule fast.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @ibm i 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/best-prompt-agent-wo…] indexed:0 read:1min 2026-11-20 · —