Cognitive Hidden Intelligence: Building AI Systems That Show Their Work
How I designed a healthcare AI framework that thinks, traces, validates, and escalates before it speaks.
Cognitive Hidden Intelligence: Building AI Systems That Show Their Work
How I designed a healthcare AI framework that thinks, traces, validates, and escalates before it speaks.
Samuel Quansah
1. Why I Built CHI
Most AI systems answer.
But in healthcare, answer is not enough.
I needed a system that could show:
What it retrieved
Which agent acted
What claim was made
What evidence supported it
What risk was flagged
Who approved it
That hidden reasoning path is what I call CHI — Cognitive Hidden Intelligence. It is the invisible logic flow inside a multi-agent AI system.
This isn’t theory. I built it — a production-grade multi-agent Healthcare Prior Authorization platform, specified across 26 architecture documents before a single line of code was written, then implemented in LangGraph and FastAPI. CHI is the framework that came out of that build.
2. The Core Idea
CHI turns black-box reasoning into observable behavior.
User Intent
→ Retrieval
→ Agent Decision
→ Logic Check
→ Citation Validation
→ Risk Flag
→ Human Review
→ Approved Output
Simple equation:
Code = structure
Agents = responsibility
RAG = evidence
Logic = reasoning
Guardrails = safety
Human review = governance
Observability = trust

3. The Orchestrator, Not an Architect Agent
Early drafts of this idea imagined one central “Architect Agent” that routes everything. In the real build, I split that responsibility deliberately — because conflating orchestration with reasoning is exactly the kind of ambiguity CHI exists to eliminate.
The actual system has seven LLM-driven agents (A1 Intake through A7 Risk Scoring, plus A10 Status Monitoring), and three orchestration constructs that are not agents at all:
A8 — Human-in-the-Loop review gate (LangGraph interrupt)
A11 — Audit event subscriber (append-only log)
A12 — The orchestrator itself (the LangGraph state machine)
Calling A8/A11/A12 “agents” would have been a modeling error. They don’t reason — they enforce. The orchestrator’s job is routing, permissions, cost caps, and review gates:
class PriorAuthGraph:
def route(self, state: PriorAuthState):
if state.requires_patient_specific_decision:
return "BLOCK"
if state.confidence_score < RISK_THRESHOLD:
return "HumanReviewAgent"
return next_agent_for(state)
Not agent chaos. Agent accountability — with a hard line between what reasons and what governs.

4. The State Object
Every AI system needs memory of its own reasoning.
In the real build this isn’t a loose JSON blob — it’s a typed PriorAuthState, built on a BaseCaseState in the domain-agnostic core, checkpointed through LangGraph's native state-persistence layer so a case can pause for human review and resume days later without losing context:
class PriorAuthState(BaseCaseState):
condition: str
known_facts: list[Fact]
retrieved_sources: list[Citation]
agent_decisions: list[AgentDecision]
risk_flags: list[RiskFlag]
human_review_required: bool
confidence_score: float
final_output_status: OutputStatus
This is where hidden intelligence becomes visible — and where it becomes replayable. Every case can be reconstructed from the audit log alone.
5. Logic Layer
AI must know the difference between fact and belief.
Operational rules, enforced in code rather than left to a prompt:
No source = no claim
Weak source = review
Conflicting evidence = escalate
Patient-specific treatment = block
The rule that matters most in practice: fail-closed by default. Any ambiguity routes to a human — never around one. That’s not a guideline in a system prompt; it’s the default posture of the orchestrator, and I’d push back hard on any future request to loosen it for speed.
6. RAG as Evidence Layer — Enforced, Not Suggested
RAG is not just retrieval. In CHI, RAG is permission.
The most important distinction between the idea and the real implementation: citation enforcement is not a prompt instruction asking the model to behave. It’s a Pydantic model_validator on the output schema itself. A gap-analysis result without a valid citation doesn't get politely ignored — it fails to construct:
class GapAnalysisOutput(BaseModel):
claim: str
citation: Citation
confidence: float
@model_validator(mode="after")
def require_citation(self):
if not self.citation.source:
raise ValueError("BLOCKED: No citation")
return self

Same discipline applies to tools. Each agent’s tool allow-list is enforced at construction time — a disallowed tool raises immediately when the agent is built, not later when it’s called and it’s too late to matter.
The rule is simple:
Retrieve less.
Prove more.
7. The Domain-Agnostic Core
One architectural decision matters more than any single agent: the strict separation between core/ and domains/prior_auth/.
Orchestration, RAG, observability, and guardrails live in core/ and know nothing about prior authorization. Everything specific to this use case — the agents, the schemas, the payer adapters — lives in domains/prior_auth/. Zero cross-contamination between the two.
That boundary is what makes CHI a framework instead of a one-off project. Porting this discipline to claims review or contract analysis later means writing a new domain package — not touching the reasoning engine underneath it.

8. Observability
Normal observability tracks servers.
CHI tracks reasoning.
Every major claim leaves a trace in an append-only audit event, with dual sinks so the log survives independently of the case state itself:
{
"claim": "Therapy X is investigational",
"source": "clinical_trials",
"agent": "A6_RiskScoring",
"confidence": 0.62,
"risk_flag": "regulatory_uncertainty",
"human_review": "required"
}

A briefing should not only show the answer. It should show how the answer was built — and it should be possible to replay any case from the audit log alone, agent by agent.
9. What Autonomy Actually Means Here
The platform supports automated submission to payers. It also ships with AUTONOMOUS_SUBMISSION_ENABLED defaulting to False, with no code path that implicitly flips it on. Autonomy is a capability the system has — not a default it assumes.
Allowed:
Condition-level briefing
Standard of care overview
Clinical trial landscape
Regulatory status
Payer policy gap analysis
Blocked without human sign-off:
PHI exposure
Patient-specific treatment decisions
Any submission when the confidence threshold isn't met
Any claim without a validated citation
10. Final Thought
The future of AI is not just fluent output.
It is visible reasoning.
The best systems will show:
What they know
What they believe
What they cannot prove
Where humans approved
That is CHI. Not a diagram of what AI governance could look like — a set of enforcement mechanisms I’ve already put into a running multi-agent system.
AI you can inspect. AI you can govern. AI you can trust.
메타데이터
- post_id
- 2b3c3abc2d7c
- slug
- cognitive-hidden-intelligence-building-ai-systems-that-show-their-work-2b3c3abc2d7c
- url
- https://medium.com/@samuelquansah/cognitive-hidden-intelligence-building-ai-systems-that-show-their-work-2b3c3abc2d7c
- canonical_url
- https://medium.com/@samuelquansah/cognitive-hidden-intelligence-building-ai-systems-that-show-their-work-2b3c3abc2d7c
- author_url
- https://medium.com/@samuelquansah
- status
- ok
- fetched_at
- 2026-07-13 07:06:27