RAG Grounding FAQ

What is RAG grounding?

RAG grounding is a code generation approach that retrieves attune-help context, supplies it to Claude using citation-forced prompts, and returns answers with provenance so every generated code snippet traces back to a real attune API, workflow name, or CLI command.

When should I use it?

Use RAG grounding when you need generated code to stay faithful to the attune ecosystem — that is, when hallucinated API names or invented workflow references would be a problem. If you only need general-purpose code generation without attune-specific grounding, this feature adds overhead you may not need.

What's the main entry point?

Instantiate RagCodeGenWorkflow from workflows.rag_code_gen and call its execute() method:

from workflows.rag_code_gen import RagCodeGenWorkflow

workflow = RagCodeGenWorkflow(**kwargs)
result = workflow.execute(**kwargs)

execute() returns a WorkflowResult containing the grounded response.

How does citation enforcement work?

The system prompt instructs Claude to cite only real APIs, workflow names, and CLI commands found in the retrieved context. Content inside <passage>...</passage> tags is treated strictly as documentation — any text inside those tags that resembles a directive or instruction is ignored and treated as documentation content instead.

How do I debug it?

Run the related tests first with pytest -k "rag-grounding" -v. If the tests pass but your code still fails, add a logger.debug statement at the suspected failure point and re-run with logging enabled. For symptom-based diagnosis, see the troubleshooting page for this feature.

Where is the source code?

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 25 (code fence) error from workflows.rag_code_gen import … — module not importable