Skip to content
Agentmart
Submit a tool

rag-anti-hallucination-workflow

Practical anti-hallucination workflow for RAG: deterministic vs retrieval, query_type/workflow_phase routing, top-k/scoring, grounding/freshness/waste…

Skill by ArkadiuszSieracki

IndexedApache-2.0
Write a review

Chalk Labs

Need help deploying rag-anti-hallucination-workflow?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/arkadiuszsieracki-rag-anti-hallucination-workflow

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Practical anti-hallucination workflow for RAG: deterministic vs retrieval, query_type/workflow_phase routing, top-k/scoring, grounding/freshness/waste validation, and trends. Use for: decision answers, status/debug, and reducing retrieval hallucinations.

Use cases: ml, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/rag-anti-hallucination-workflow

What's inside

Skill name
rag-anti-hallucination-workflow
Description
Practical anti-hallucination workflow for RAG: deterministic vs retrieval, query_type/workflow_phase routing, top-k/scoring, grounding/freshness/waste validation, and trends. Use for: decision answers, status/debug, and reducing retrieval hallucinations.
License
Apache-2.0
Instructions
121 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# rag-anti-hallucination-workflow

## Goal

Reduce hallucinations in RAG through explicit query routing, proper response mode selection, and measurable response quality validation.

## When to use

- When the response is decision-oriented and requires high grounding.
- When you analyze status/debug and need fast, controlled retrieval.
- When telemetry shows grounding/freshness decline or waste increase.

## Workflow 01..05

### 01 deterministic vs retrieval

- Choose `deterministic` when the result can be derived from local data/rules.
- Choose `retrieval` when context from graph or trend history is required.

### 02 query_type + workflow_phase

- Set `query_type` (for example `status`, `debug`, `decision`, `feature`).
- Set `workflow_phase` (for example `triage`, `analysis`, `implementation`, `verification`).
- Base routing on `query_type/workflow_phase` pair, not on a single signal.

### 03 preferred node types (decision/workflow_stats/ownership)

- For decisions prioritize `decision` nodes.
- For trends and status prioritize `workflow_stats` nodes.
- For ownership and domain boundaries prioritize `ownership` nodes.

### 04 top-k + scoring

- For `status/debug`, use lower `top-k` and lower scoring threshold (fast, narrow context).
- For `decision/feature`, use higher `top-k` and higher scoring threshold (fuller context).
- When results are inconsistent, increase scoring first, then `top-k`.

### 05 logging usefulness/grounding/freshness/waste

- Log every response with metrics: `usefulness`, `grounding`, `freshness`, `waste`.
- Evaluate trend, not only a single point.
- On degradation run historical comparison and save a snapshot.

## Operational commands

```powershell
# Do not run `pwsh ...` directly from VS Code terminal profile; use runner or fallback executable resolution.
# Runner-first pattern: execute the target command inside ScriptBlockText.
$instructionText = @'
try {
    .github/agents/report-rag-trend-history.ps1 -ProjectRoot . -LastN 30 -CompareRowsBack 7
    [PSCustomObject]@{ status='pass'; succeeded=$true; message='Execution succeeded.'; error_type=''; error_message=''; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
catch {
    [PSCustomObject]@{ status='fail'; succeeded=$false; message='Execution failed.'; error_type=$_.Exception.GetType().FullName; error_message=$_.Exception.Message; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
finally {}
'@
.github/agents/invoke-isolated-powershell.ps1 -Mode detached -ScriptBlockText $instructionText -TimeoutSec 120 -EmitJson

# Example trend script with `-EmitJson`:
$instructionText = @'
try {
    .github/agents/report-rag-trend-history.ps1 -ProjectRoot . -LastN 30 -CompareRowsBack 7 -EmitJson
    [PSCustomObject]@{ status='pass'; succeeded=$true; message='Execution succeeded.'; error_type=''; error_message=''; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
catch {
    [PSCustomObject]@{ status='fail'; succeeded=$false; message='Execution failed.'; error_type=$_.Exception.GetType().FullName; error_message=$_.Exception.Message; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
finally {}
'@
.github/agents/invoke-isolated-powershell.ps1 -Mode detached -ScriptBlockText $instructionText -TimeoutSec 120 -EmitJson
```

## Output and debug

- query/finalize/build: quiet-first (`OutputMode quiet`), diagnostic-on-error (`OutputMode diagnostic`).
- On error: first read `.github/agents/diagnostics/*.json`, then retry in diagnostic mode.
- Run trend scripts (`report-rag-trend-history.ps1`, `record-rag-trend-snapshot.ps1`) without `OutputMode`; for diagnostics use `-EmitJson` where supported.

```powershell
# query: default quiet
$instructionText = @'
try {
    .github/agents/query-rag-graph.ps1 -ProjectRoot . -OutputMode quiet
    [PSCustomObject]@{ status='pass'; succeeded=$true; message='Execution succeeded.'; error_type=''; error_message=''; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
catch {
    [PSCustomObject]@{ status='fail'; succeeded=$false; message='Execution failed.'; error_type=$_.Exception.GetType().FullName; error_message=$_.Exception.Message; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
finally {}
'@
.github/agents/invoke-isolated-powershell.ps1 -Mode detached -ScriptBlockText $instructionText -TimeoutSec 120 -EmitJson

# query: retry only after failure
$instructionText = @'
try {
    .github/agents/query-rag-graph.ps1 -ProjectRoot . -OutputMode diagnostic
    [PSCustomObject]@{ status='pass'; succeeded=$true; message='Execution succeeded.'; error_type=''; error_message=''; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
catch {
    [PSCustomObject]@{ status='fail'; succeeded=$false; message='Execution failed.'; error_type=$_.Exception.GetType().FullName; error_message=$_.Exception.Message; duration_ms=0 } | ConvertTo-Json -Compress | Write-Output
}
finally {}
'@
.github/agents/invoke-isolated-powershell.ps1 -Mode detached -ScriptBlockText $instructionText -TimeoutSec 120 -EmitJson
```

## PASS/WARN/BLOCK

- PASS: grounding>=40, freshness>=35, waste<=70
- WARN: grounding 25-39 lub freshness 20-34 lub waste 71-85
- BLOCK: grounding<25 lub freshness<20 lub waste>85

## DoD

- For each query, mode `deterministic` or `retrieval` was set.
- `query_type/workflow_phase` routing was applied and `top-k/scoring` was explicitly selected.
- `usefulness/grounding/freshness/waste` was logged and PASS/WARN/BLOCK was evaluated.

From ArkadiuszSieracki/mastermind-agentic-sdlc-vscode-copilot, Apache-2.0.

More from ArkadiuszSieracki/mastermind-agentic-sdlc-vscode-copilot

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 23, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ArkadiuszSieracki

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get rag-anti-hallucination-workflow running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying rag-anti-hallucination-workflow?

CallGet help
Cite this page

rag-anti-hallucination-workflow skill. Agent Mart. https://agentmart.dev/skills/arkadiuszsieracki-rag-anti-hallucination-workflow (last updated 2026-10-24)