·

Real World Workflow From Documents To Structured Spec

Walk through a real production workflow that uses Google Drive MCP so your AI agent can search, read, and organize files end to end.

This is the workflow the previous five topics have been building toward: a team has a feature scattered across a product brief, two rounds of design review notes, a Slack-thread-turned-Doc summary, and a stakeholder deck — and someone needs to turn that into a spec engineering can actually implement against, with source traceability so it survives review. It's a task that used to take a senior engineer half a day of reading and cross-referencing. With Drive MCP driving discovery and extraction, and a human doing the final judgment calls, it compresses to under an hour of active work plus a review pass.


Workflow Overview: Document Discovery to Actionable Requirements

The workflow has three phases, each with a distinct failure mode if you skip it or rush it:

  1. Discovery — find every relevant document across Drive, not just the ones you already knew about. This is where naive keyword search either misses documents (wrong terminology) or drowns you in noise (a common term matching dozens of unrelated files).
  2. Extraction and reconciliation — pull structured requirements out of each document, then merge them, explicitly surfacing contradictions rather than silently picking a winner.
  3. Spec production and traceability — write the final spec in your team's format, with every requirement traceable back to its source document, so a reviewer (or you, six months later) can verify a claim without re-reading everything from scratch.

Skipping phase 1's breadth check is the most common mistake — teams frequently run one search, get a plausible-looking set of five documents, and proceed, missing a sixth document that used different terminology for the same feature (a doc calling it "smart retries" instead of "webhook retry policy," say). Skipping phase 2's explicit reconciliation step is the second most common — merging documents into one narrative without flagging disagreements produces a spec that reads confidently but is silently wrong wherever two source documents actually disagreed.

The tooling for this doesn't care which client you're driving it from — Claude Code, Cursor, OpenCode, or Gemini CLI all expose the same underlying search/read/list tools. This walkthrough uses Claude Code CLI for concreteness, but every prompt pattern transfers directly.

Tips
- Never treat the first search result set as complete — a second pass with synonym or alternate-terminology queries catches documents the first pass misses.
- Build reconciliation into the process explicitly as its own phase, not an implicit side effect of summarization — contradictions surfaced late in a project are far more expensive than contradictions caught during spec drafting.
- Design the final spec's traceability from the start of the workflow, not as a cleanup step at the end — retrofitting citations onto an already-written spec is much slower than tracking sources as you go.


Step 1: Searching and Ranking Relevant Documents Across Drive

Start broad, then narrow. A single keyword search under-covers real-world documents because stakeholders don't converge on consistent terminology — the same feature gets called different things by product, design, and engineering.

Search Drive for documents related to a feature I'll call "checkout
retry handling" — it might also be referred to as "payment retries,"
"failed payment recovery," or "smart checkout retry" in different
documents. Run separate searches for each term and combine the results,
removing duplicates. List title, folder path, owner, and last modified
date for every match.

Running separate queries per candidate term and combining results, rather than one OR-joined query, is deliberate — Drive's query language does support or within fullText contains clauses, but in practice, running distinct queries and having the model deduplicate the combined result set surfaces edge-case matches more reliably than one compound query, and it's easier to audit which term actually found which document.

fullText contains 'checkout retry handling'
fullText contains 'failed payment recovery'
fullText contains 'smart checkout retry'

Once you have a combined list — realistically 8 to 20 documents on an active feature area — rank before reading everything:

Given this list of documents, rank them by likely relevance to
"checkout retry handling requirements" using title, folder location,
and recency as signals. Flag any documents that look like they might
be duplicates or superseded drafts of another document in the list
(similar titles, close modification dates).

This ranking pass is what makes the difference between reading twenty documents and reading the five that actually matter. Folder location is a stronger signal than people usually credit — a document sitting in /Product/Checkout/Archive is very likely superseded even if its title looks current, and an agent explicitly told to weigh folder path will catch that; one that isn't told will treat all twenty documents as equally live.

For anything genuinely large — a feature area with real history spanning many months — scope the search with a date filter before ranking, since ranking twenty barely-relevant documents wastes both your time and the model's context:

name contains 'checkout' and modifiedTime > '2026-03-01T00:00:00'

Tips
- Run multiple synonym-based searches and merge results rather than relying on one query with all terms — synonym coverage matters more than query cleverness for real-world document discovery.
- Explicitly weigh folder location (archive folders, deprecated-marked paths) as a relevance signal — it's a strong and underused indicator of which documents are actually current.
- Scope with a date filter before ranking on any feature area with substantial history — ranking noise you could have filtered out first wastes both review time and context budget.


Step 2: Extracting, Deduplicating, and Reconciling Conflicting Requirements

With a ranked, deduplicated document set — say the five genuinely relevant ones out of an original fifteen — extract requirements from each independently before attempting any merge, exactly as covered in the multi-document synthesis pattern from earlier in this module, but now at production scale.

For each of these 5 documents, read it fully and extract requirements
as a structured list: requirement description, category (functional /
edge-case / non-functional), and the exact source sentence it came
from. Do this independently for each document — don't compare across
documents yet.

1. "Checkout Retry - Product Brief" 
2. "Payment Recovery - Design Review Notes v2"
3. "Smart Retry - Eng Feasibility Doc"
4. "Checkout Retries - Stakeholder Deck"
5. "Failed Payment Handling - Support Team Input"

Notice that fifth document — support team input — is a category that discovery searches often miss because support-facing documents rarely use product terminology. It's worth a dedicated search pass specifically for operational/support documents on any feature that touches a customer-facing failure path, since support teams frequently know edge cases (specific error codes, actual customer complaint patterns) that never made it into a product brief.

With five independent extraction lists in hand, run the reconciliation pass as a distinct step:

Now compare the five extraction lists. Produce:

1. A merged requirements list, deduplicating requirements that appear
   in multiple documents (cite all sources for each).
2. A "Conflicts" section for any requirement where documents disagree
   — quote the conflicting statements exactly, don't paraphrase them
   into false agreement.
3. A "Support-Only Insights" section for anything from the support
   team doc that doesn't appear in any product-facing document —
   these are easy to lose and often describe real production behavior
   the product docs never captured.

A realistic conflict surfaced this way:

## Conflicts

**Retry count for failed card payments:**
- Product Brief: "up to 3 retries"
- Eng Feasibility Doc: "retries capped at 2 due to payment gateway rate
  limits — see gateway vendor's rate limit doc"
- Resolution needed: the eng doc's technical constraint likely
  supersedes the product brief's aspirational number, but this needs
  explicit confirmation from product before finalizing the spec.

That resolution note — flagging which side probably wins but declining to decide unilaterally — is exactly the right amount of AI judgment for this task: enough to save a human from reading both documents cover to cover to spot the conflict, not so much that it silently overrides a real constraint or a real product decision without visibility.

Tips
- Explicitly search for support/operations-team documents in addition to product and design documents — they're systematically under-covered by product-terminology searches and often carry genuine production-behavior insight.
- Require exact quotes, not paraphrases, in any conflicts section — paraphrasing conflicting statements makes it too easy for two genuinely different claims to read as compatible.
- Have the model suggest which side of a conflict is more likely correct (e.g., a technical constraint over an aspirational number) but require it to flag rather than silently resolve — this keeps a human in the loop on decisions that matter.


Step 3: Producing a Reviewed Spec and Linking It Back to Source Docs

The final phase turns the reconciled requirements list into an actual spec document, formatted for your team's conventions, with every requirement traceable to its source — the traceability is what makes this spec trustworthy enough to implement against without re-verifying everything by hand.

Using docs/specs/TEMPLATE.md as the structure, draft
docs/specs/checkout-retry-handling.md from the merged requirements list.

For every requirement in the spec, add an inline citation in the format
[source: <document title>] immediately after the sentence stating it.

Populate the "Open Questions" section of the template with every item
from the Conflicts section that hasn't been resolved yet — don't
resolve them, list them as-is for product/eng to answer together.

A representative slice of the resulting spec:

## Retry Behavior

The system retries failed card payments up to a maximum determined by
gateway rate limits [source: Eng Feasibility Doc]. The retry interval
uses exponential backoff starting at 30 seconds [source: Design Review
Notes v2].

## Open Questions

1. **Retry count**: Product Brief states "up to 3," Eng Feasibility Doc
   states a hard cap of 2 due to gateway rate limits. Needs explicit
   decision — see Conflicts analysis, 2026-08-21.
2. **Support-flagged edge case**: Support team input notes that retries
   currently silently fail for expired-card errors specifically,
   without surfacing a distinct error message to the customer. Not
   addressed in any product-facing document — needs a decision on
   whether this is in scope for this iteration.

Committing this to the repo through the normal PR flow, rather than leaving it as chat output, is the step that actually closes the loop — it makes the spec reviewable, versioned, and linkable from the eventual implementation PR:

git checkout -b spec/checkout-retry-handling
git add docs/specs/checkout-retry-handling.md
git commit -m "Add checkout retry handling spec, sourced from Drive docs"
git push -u origin spec/checkout-retry-handling

Before merging, do one manual verification pass — spot-check three or four of the inline citations against the actual source documents. This isn't paranoia; it's the same discipline you'd apply to any AI-assisted output that other people will build on top of. A citation that's slightly off (attributing a requirement to the wrong document, or quoting a paraphrase as if it were exact) is exactly the kind of error that's easy for a reviewer to wave through, because the spec reads confidently either way — the citation format itself doesn't prove accuracy, it just makes accuracy checkable if someone actually checks.

The full loop — search, rank, extract independently, reconcile explicitly, draft with citations, spot-check, commit through review — is what separates a genuinely useful AI-assisted requirements process from one that just produces plausible-sounding documents faster than a human would notice they're wrong.

Tips
- Require inline source citations on every requirement in the final spec, in a consistent format — it's what makes the spec auditable rather than just plausible.
- Populate an Open Questions section directly from unresolved conflicts rather than letting the model make a final call on anything genuinely contested — that decision belongs to the humans who own the requirement.
- Always spot-check a sample of citations against source documents before merging the spec — a confident-sounding citation format doesn't guarantee accuracy, and a quick manual check catches the rare misattribution before it propagates into implementation.


Tips

Tips
- Treat discovery, extraction, and spec production as three genuinely distinct phases with different failure modes — collapsing them into one big prompt tends to hide the exact mistakes (missed documents, silently merged conflicts) that this three-phase structure is designed to surface.
- Deliberately search beyond product-facing documents — support, ops, and engineering-feasibility docs routinely carry constraints and edge cases that never made it into a product brief, and they're the documents a naive search is most likely to miss.
- Build source traceability into the spec from the start and verify a sample of it before merging — a spec that reads well isn't the same as a spec that's actually accurate, and citations only deliver value if someone occasionally checks them.