shared/workflows/phase-0-context-gather
Source:
shared/workflows/phase-0-context-gather.md
workflow: Phase 0 — context gather
The fan-out step. Every polymorphic skill runs this first. Reads everything referenced in the user’s input.
Inputs
- Raw user prompt + any URLs / paths / IDs in it.
- Current working directory (resolves
<repo>/.adk/+<repo>/ai-guidelines/). $ADK_CONFIG_HOME/core.yaml (+ repos.md + connectors/*.md)(workspaces, repos, data sources).
Steps
- Run
scripts/url_classifier.pyon the prompt. Get back JSON:{urls: [...], local_paths: [...], freeform: "..."}. - Pick the working repo: match
cwdagainstrepos.md frontmatter repos[*].path. If no match: ask the user to confirm or specify a repo. - Pick the active workspace: derive from the matched repo’s
workspacefield. If multi-workspace user is ambiguous: ask. - Resolve task-slug + task folder via
scripts/adk_task_slug.py --skill <stem> --input <prompt> --create --json. The script picks the right root pershared/paths.md(repo-bound vs global), derives the discriminator from the input (Jira key, PR number, repo+date, etc.), and returns the absolute path. Skills that are always global (pr-review,investigate,setup,improve,explain) pass--scope global; skills that are always repo-bound (implement,document) pass--scope repo; hybrid skills (review,sync) pass--scope autoand let the script decide. - Use the returned
task_diras the working dir for the rest of this skill run. Every artifact path below is relative to it. - Fan-out fetch each URL in parallel (cap 4 concurrent) via the matching MCP. See
shared/input-classifiers/<type>.mdfor each URL type’s fetcher. - Merge results into
<task_dir>/context.md. One section per source. Quote ≤15 words per claim; link out for the rest. - Optional RAG enrichment: if
rag.enabled: trueAND prompt matchesrag.trigger_keywords(or user explicitly says “check our internal docs”), query the RAG MCP with the prompt + key entities. Merge results tagged[source: rag]. - Load relevant guidelines: based on detected task category (frontend / api / data / observability / security / …), pre-load matching
shared/guidelines/*.mdinto the working context.
Output
<task_dir>/context.md layout:
# context for <task-slug>## working repo- name: storefront-bff (from repos.md repos[0])- path: /Users/sujeet/code/acme/storefront-bff- workspace: personal-work## sources fetched### [jira] SF-1234 — coupon enginefetched: 2026-05-18T10:00Zsummary: 2-sentence summarykey fields: status=In Progress, assignee=sujeet, sprint=Sprint 47acceptance criteria: - …link: https://acme.atlassian.net/browse/SF-1234### [confluence] storefront-bff design docfetched: 2026-05-18T10:00Zsummary: 2-sentence summaryrelevant section: "Coupon engine" — at https://acme.atlassian.net/wiki/...### [github-pr] #456 — prior coupon workfetched: 2026-05-18T10:00Zsummary: …relevant diff: services/coupon.py +120/-30link: https://github.com/...### [rag] internal coupon policy docfetched: 2026-05-18T10:00Zchunks: 3relevance: highquoted: "…" (link)### [skipped] [slack] — credentials file missing tokengap: SLACK_BOT_TOKEN not exported by $SLACK_CREDENTIALS_FILEAnti-patterns
- Fetching transitively. Follow links the user gave you. Don’t follow links inside fetched content. One hop.
- Embedding fetched bodies. Quote tightly, link for the rest. Save tokens.
- Failing the whole phase on one source. If 4 of 5 sources fetched and 1 failed, report the failure and proceed.
- Auto-running expensive queries (full DD log dump, Snowflake table scan). The user did not ask for that — only fetch what each URL points at.