Skip to content

Code Grounding Agent

The Code Grounding Agent (atelier-code-grounding) is an internal subagent used by Atelier skills such as Revise, Explore, and Verify.

Do not invoke it directly. Atelier calls it when a skill needs source-backed code evidence for a plan, walkthrough, revision, or verification report.

  • A skill needs to locate functions, classes, interfaces, constants, or error-handling logic in code
  • A document revision references implementation details that need to be checked against source
  • A walkthrough needs source-backed excerpts with links that survive nearby edits
  • Verification needs evidence for acceptance criteria in changed code

The agent receives a batched request with:

  • file — Code file to search.
  • link_base — Optional output directory used to make generated links relative to the report or walkthrough.
  • queries — One or more query IDs with natural-language descriptions of the code evidence needed.
  1. Extracts search terms — Identifies function names, types, constants, errors, imports, and related technical terms.
  2. Searches the target file — Looks for relevant definitions, branches, comments, and implementation details.
  3. Captures complete passages — Returns full logical blocks rather than isolated matching lines.
  4. Generates deep links — Uses Atelier’s text-fragment helper to produce ready-to-paste links such as ./src/router.ts#:~:text=....
  5. Explains relevance — Groups passages by query ID and includes short reasoning for each result.

The parent skill receives structured markdown grouped by query:

  • Query — The query ID supplied by the parent skill.
  • File — The searched source file.
  • Passages — Relevant excerpts with a text-fragment Location, a relevance sentence, and concise code content.
  • Reasoning — One to three sentences explaining why the selected passages answer the query.

If nothing relevant is found, the agent returns an empty result with reasoning instead of fabricating evidence.

The agent favors complete, precise, source-backed passages. It excludes boilerplate, import-only mentions, duplicate excerpts, and test code unless the query specifically asks about tests.