Practical Notes
- Quant: run on 2 repos and compare output size (chars/tokens) before/after adding ignore rules.
- Quant: keep a baseline prompt snapshot and diff it weekly to spot context drift.
Pattern: context as an artifact
Treat the generated prompt like a build artifact:
- Check it into a scratch folder (or attach to PRs) when you need reproducibility.
- Add ignore rules aggressively to keep noise down.
- Prefer smaller, task-scoped prompts over one giant dump.
Agent workflow tip
Use code2prompt as a pre-step before:
- running an agent to refactor,
- generating docs,
- or doing security review of changes.
If you record the prompt file, you can replay the same context across models and compare results.
FAQ
Q: Is this only a CLI? A: No. The repo describes a wider ecosystem, but the CLI alone is already useful for most workflows.
Q: How do I reduce prompt size? A: Add ignores and scope to a subdirectory; prioritize only the files needed for the task.
Q: Can I use it for reviews? A: Yes—generate a snapshot prompt and attach it to a PR so reviewers/agents share the same context.