Note: RAG grounding

Context

RAG-grounded code generation is implemented in workflows.rag_code_gen. The workflow retrieves attune-help documentation at runtime, injects it into a citation-enforcing system prompt, and returns answers with provenance tied to real source files.

The system prompt (defined in _SYSTEM_PROMPT) explicitly forbids the model from inventing attune features. Retrieved content arrives inside <passage>...</passage> tags and is treated as documentation, not as instructions — including any text inside those tags that attempts to act as a directive.

How it works

RagCodeGenWorkflow is the single public entry point. You construct it with keyword arguments and call execute(**kwargs) to run the full retrieval-and-generation cycle, which returns a WorkflowResult.

from workflows.rag_code_gen import RagCodeGenWorkflow

result = RagCodeGenWorkflow().execute(query="How do I define a task template?")

Because generation is grounded in retrieved context, every claim the model makes can be traced back to the attune-help passage it came from. The system prompt instructs the model to cite the source file for any pattern it references.

Source: src/attune/workflows/rag_code_gen.py

Tags: rag, retrieval, grounding, faithfulness, citation

Unresolved references

Auto-generated by attune-author fact-check. Review and either fix the source code, fix this doc, or add an override.

Location Severity Issue
Line 23 (code fence) error from workflows.rag_code_gen import … — module not importable