← Back to library

Run a multi-phase RAG rebuild from Markdown specs

Remigiusz Samborski, a Google developer advocate writing on DEV Community, rebuilt a RAG reference app with Gemini CLI and its Conductor extension. Product, stack, milestone and plan documents live in the repo; each feature runs as a track; the agent follows a red-green-refactor loop with an 80% coverage bar before commits. Multi-day work cost about $30 in model fees.

  • OutcomeMove a retrieval app across infrastructure, backend, data and UI layers while the agent keeps one consistent plan and proves each change with tests.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditRemigiusz Samborski
View original
Works with
GeminiCustom agent

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 23, 2026

When should you use it?

  • A project spans Terraform, Python services, a web front end and data pipelines
  • You want the agent to keep project-level context between sessions
  • Your team already reviews work in pull requests

Not for: A quick one-file script; Teams with no test suite or CI to lean on

What do you need, and what do you get?

You need

  • A repo with room for a specs folder
  • Short notes on the product, the tech stack and the milestones
  • A test runner and coverage tool

You get

  • Markdown product, stack, track and plan files kept in the repo
  • Feature tracks implemented with tests written first
  • Infrastructure defined as Terraform so environments can be recreated

How does it work, step by step?

  1. Write the source of truth firstCreate product, tech-stack, tracks and workflow documents so the agent reads the same intent every time it starts.
  2. Initialize with a guided setupAnswer the extension's questions about users, stack and major features so it scaffolds the planning folder.
  3. Split work into tracksTreat each big feature as its own track with a step-by-step plan file you can review before code is written.
  4. Make tests the gateRequire failing tests, then passing code, then refactor, and refuse a commit below the coverage target.
  5. Keep infrastructure in codeAsk for Terraform for every cloud resource the project touches so a fresh environment is one apply away.

The prompt

Our own prompt, inspired by Remigiusz Samborski and written to work in Gemini and Custom agent. Values in lime are placeholders.

Prompt0 variables
You are working in this repository. Read the files in /conductor (product, tech stack, tracks, workflow) before doing anything. Pick up the next unchecked task in the plan for track [track name]. Write a failing test first, then the smallest code that passes, then refactor. Do not commit unless new code reaches [80]% coverage. Any cloud resource you add must be defined in Terraform. When a task is done, tick it in plan.md and summarize what changed.

Inspired by Remigiusz Samborski: How I used Gemini CLI to orchestrate a complex RAG migration. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Spec files drift if nobody updates them when plans change; edit the plan before asking for new code.
  • A coverage number can be gamed by shallow tests, so still read the assertions on risky paths.

Our take

This is among the clearest write-ups of spec-driven work on a project with many moving layers. The value is not the particular extension; it is the discipline of putting intent, stack and plan into files the agent rereads, then refusing commits that have not passed tests. The cost figure is a useful sanity check for teams nervous about token bills on multi-day work. If you adopt the pattern, give one human ownership of the plan files, because stale plans are worse than none. Split work into tracks so parallel features do not collide. Keep infrastructure as code beside the app specs. Make the coverage bar real by failing the commit when tests miss it, not by hoping the agent remembers. Review generated plans before execution starts. When migrating cloud pieces, keep the old path runnable until the new one has served real traffic. Archive finished track plans so the agent does not reopen closed work.

Where the time goes back: Planning documents that persist in the repo stop the agent from re-deriving context each session, and test gates catch bad output before it reaches review.

FAQ

Which models did the author use?
Three Gemini models of different sizes, switching between the Pro, Flash and Flash Lite tiers by task.
Why was the bill so low?
Most input tokens were cached, because the same planning documents were reread on every turn.

Source and credit

Inspired by Remigiusz Samborski. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
How I used Gemini CLI to orchestrate a complex RAG migration
Creator
Remigiusz Samborski
Published on
DEV Community (dev.to)
Original date
Apr 28, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Gemini
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in Operations & Admin

All 203 Operations & Admin playbooks →

Related playbooks

Operations & AdminWorkflow✓ AI dry run

Add a merge check for every way coding agents break code

Keep a running list of the specific ways coding agents have damaged your repository, from hollow tests and invented fake responses to deleted files and silenced type errors, and turn each one into an automated gate that blocks the merge, so the same mistake cannot slip through review twice.

Credit: u/alexmarquardt on r/ClaudeCode

An afternoon+
Operations & AdminPrompt✓ AI dry run

Give your agents one shared wiki that only one agent edits

Replace scattered agent memories with a single Markdown wiki in git: every agent reads a short daily brief from it, agents and scripts file sourced notes into an inbox instead of editing pages, one steward agent checks and merges those notes each morning, and private agent memory keeps only personal preferences.

Credit: Siim Tolk

An afternoon+