Evidence-Gated Agent Workspace for Compliance Rules
Each US state sets its own retirement mandate for employers. This system turns those laws into rules a program can run, and legal specialists write them together with an AI agent.
How a rule gets written
- AskAsk
- DraftDraft
- TestTest
- ReviewReview
- CheckCheck
- LiveLive
API serverthe tools behind the agent
- read rules
- read sources
- read version history
- read state resources
Generation pipelinethe only write path
- research
- build candidate
- engine test
- ↺ repair
- candidate
- no change
- needs input
- failed
Rule Studio chat1 · Questionread-only answer2 · Change requestplan, confirm, diff
How does Illinois count employees for the mandate?
read rulesread sourcesThe rule uses the lowest quarterly count in the previous calendar year. The threshold is 5 employees.Answered from reads. Nothing queued, nothing changed.
Make the employee-count question clearer.
Agent · proposed plan
Keep the threshold at 5. Clarify the question wording. Prepare a candidate for review.
Confirm planCandidate · wording changeengine test · pass
7 / 7Reads go straight to tools. A write needs a confirmed plan and comes back as a tested candidate.
- A legal specialist asks the agent a question.
- The agent loops over read-only tools until it can answer. Nothing is written.
- Next, the specialist asks for a change.
- A change is routed to plan mode. The agent proposes a plan, not an edit.
- A person confirms the plan. That is the only way into the write path.
- The pipeline builds a candidate, tests it on the real engine, and returns one of four named outcomes.
- Reads go straight to tools. A write needs a confirmed plan and comes back as a tested candidate.
The agent can read everything and write nothing. Only a person can confirm a plan, apply a draft, or approve a version.
Think of pull requests for law. The agent opens the change, an engine runs it like CI, a legal specialist reviews, and the merge is blocked when the cited source no longer matches.
How a version goes live
- AskAsk
- DraftDraft
- TestTest
- ReviewReview
- CheckCheck
- LiveLive
Check every cited source, read again at approval
Web pages are compared by main text. PDFs byte for byte.
Approval blocked. No override.Regenerate from the current sources.
3 / 3One source changed, so approval is blocked. Nobody can override it, and the live version stays live.
- A legal specialist asks to approve v4. v3 is live.
- Every cited source is read again and compared with its snapshot.
- One source changed, so approval is blocked. Nobody can override it, and the live version stays live.
At approval the system fetches every cited source again. One changed source blocks approval, and nobody can override it.
More on how rules are checked
Workspace boundary
Its read-only tools access the rule bundle, selected source inventory, state resources, and version histories.
The chat agent's job is judgment over messy sources, so it gets broad read access and no write path. Only a person can confirm a plan, apply a candidate, or approve a version. A confirmed plan freezes one generation request in the API queue. A cancelled or failed run leaves the draft unchanged.
Workspace boundary: problem, implementation, reasoning, and outcome
- Problem
- Legal specialists need help researching and drafting state rule changes, but an agent that can write rules could silently change what employer assessments depend on. Long research conversations also have to survive worker restarts.
- Implementation
- Legal specialists chat with a resident worker that hosts the agent on Amazon Bedrock. Its read-only tools access the rule bundle, selected source inventory, state resources, and version histories. The selected source inventory is fixed, but reading a source fetches its live content. Chat session checkpoints are stored on the workspace and validated for configuration, size, integrity, and session identity before restore. A confirmed plan freezes one generation request in the API queue. The API dispatches it when capacity is available. The worker claims the run atomically, reports activity and model usage, and returns one of four named outcomes: candidate, no change, needs input, or failed. Applying it is a separate action. A teammate built research generation and quote validation.
- Reasoning
- The chat agent's job is judgment over messy sources, so it gets broad read access and no write path. Freezing each request and naming every outcome makes runs auditable, and lets the workspace treat "nothing to change" or "ask the reviewer" as normal results instead of errors.
- Outcome
- As of November 2026, rules for 20 states have been generated and are moving through specialist approval. IRALOGIX internal users have worked with the system through several rounds of feedback.
Candidate validation
Candidate checks run representative answers through the real engine and send failures back to the agent for repair.
Schema validation alone cannot show whether a generated questionnaire can run. Exercising the real engine exposes failures before a legal specialist reviews the draft. Findings trigger a repair turn in the same agent session, with one extra candidate attempt by default. A repeated finding signature or an exhausted budget ends the run without a draft.
Candidate validation: problem, implementation, reasoning, and outcome
- Problem
- Legal specialists need help researching and drafting state rule changes, but an agent that can write rules could silently change what employer assessments depend on. Long research conversations also have to survive worker restarts.
- Implementation
- Candidate validation resolves the rule graph and exercises representative answers through the real engine, checking for engine errors, dead ends, unanswerable questions, and invalid outcomes. Crashed checks fail closed. Findings trigger a repair turn in the same agent session, with one extra candidate attempt by default. A repeated finding signature or an exhausted budget ends the run without a draft. The API stages a passing candidate for side-by-side comparison.
- Reasoning
- Schema validation alone cannot show whether a generated questionnaire can run. Exercising the real engine exposes failures before a legal specialist reviews the draft.
- Outcome
- As of November 2026, rules for 20 states have been generated and are moving through specialist approval. IRALOGIX internal users have worked with the system through several rounds of feedback.
Evidence gate
Source drift blocks approval and requires regeneration.
At approval, the worker re-fetches live sources using the recorded capture profile. It compares a hash of normalized main text for HTML and raw bytes for PDFs. SOURCE_CHANGED has no override. The legal specialist must regenerate from current sources, review and apply the new candidate, then request approval again.
Evidence gate: problem, implementation, reasoning, and outcome
- Problem
- Generated output cannot become compliance authority, and neither can a live web page. State sites change or disappear, so a rule approved against a URL is hard to defend later. Reviewers also need to trace a rule across values, questionnaire logic, wording, and the source it came from. A cited source can change between generation and approval.
- Implementation
- Each state is modeled as four versioned artifacts linked by stable identifiers: a rule model, decision graph, wording catalog, and audit trail. Cited sources are captured HTTP-first with a serialized Playwright fallback for pages that need a browser, with SHA-256 fingerprints. The review workbench presents model and source together, lets legal specialists test a pending version through the session runner, and records the reviewer name supplied with a decision. At approval, the worker re-fetches live sources using the recorded capture profile. It compares a hash of normalized main text for HTML and raw bytes for PDFs. Only after all cited sources match are verified captures saved in S3. SOURCE_CHANGED has no override. Drift marks the evidence stale, leaves the new bundle pending, and preserves the prior active bundle. The legal specialist must regenerate from current sources, review and apply the new candidate, then request approval again.
- Reasoning
- The schema constrains what an author or agent can propose, and the review gate determines what is authoritative. Snapshots preserve the source text used by a rule, while re-fetching live sources stops a stale draft from becoming active. Approval checks live evidence rather than re-reading an archive. Browsers are the worker's largest memory cost, so a file lock allows one Chromium at a time in that pod. HTTP-first capture keeps that heavy dependency off the common path. The gate checks evidence freshness and does not guarantee legal correctness.
- Outcome
- As of November 2026, rules for 20 states have been generated and are moving through specialist approval. IRALOGIX internal users have worked with the system through several rounds of feedback.
What a rule does once it is live
Employers
Employer A
active- 3 employees, since 2020
- No qualified plan
- Required steps: done
Employer B
active- 3 employees, since 2020
- No qualified plan
Employer C
active- 12 employees
- 401(k) plan
Illinois question path
Results
Employer A
Not requiredSame log, same resultEmployer B
Not requiredBelow 5-employee thresholdEmployer C
ExemptQualified 401(k) plan- Employer A follows the rules to Covered by the mandate.
- Employer B's three employees lead to Not required.
- Employer C's 401(k) plan leads to Exempt.
- A rewinds headcount. The old answers remain logged.
- A answers 3. Replaying the log returns Not required.
- Replaying the same log returns the same result. Version pins stay fixed.
The engine asks one question at a time and follows the approved rules to a result. No AI runs at this stage.
- Deterministic.The same answers and the same rule version give the same result.
- Pinned.A session keeps the rule version it started with.
- Nothing is erased.Every answer is kept, so a session can resume, rewind, or branch.
More on the engine
I designed and implemented a deterministic Python/FastAPI engine with RESTful APIs over pinned rule bundles. Append-only session histories make employer assessments reproducible and let sessions resume or branch.
A pure projector folds the pinned bundle and event log into the current frontier, gates, outcome, and report state.
- Deterministic. The same log and bundle always give the same result. No I/O or model call happens during a turn.
- Pinned. A session keeps the rule version and wording it started with, even after a newer version goes live.
- Rewind keeps a true path. A rewind drops the answer it names and every later answer from the effective path.
- Derived status. Status is always computed from the log.
Problem, implementation, reasoning, and outcome
- Problem
- An employer may return later or test another answer. The result must remain reproducible after rules or wording change, and the same answers must always produce the same guidance.
- Implementation
- A pure projector folds the pinned bundle and event log into the current frontier, gates, outcome, and report state. The session row pins rule and catalog versions plus locale. The append-only log records answers and rewinds. A fork copies a selected event prefix into a new session with the same pins. No live model call or external fetch sits on the assessment path.
- Reasoning
- Agent work belongs before approval, where a person reviews it. Mutable questionnaire rows would erase how a result was reached, so append-only history makes replay and branching explicit, and version pins keep the same log from changing meaning later.
- Outcome
- Resume, rewind, and session fork are implemented. The alert subsystem projects saved session histories and dispatches notifications through the signed webhook channel.
My role
I led product direction and architecture for the whole system, as team lead of a five-person CMU Studio team.
I built the agent workspace API, read-only chat tools, dispatch, candidate validation, staging, the approval-time evidence gate, and the deterministic Python/FastAPI engine. I designed the generation pipeline. A teammate built its research generation and quote validation.
Tech stackPython, FastAPI, Amazon Bedrock, MCP, PostgreSQL, Amazon S3, Playwright, Event sourcing, OAuth2/OIDC, Kubernetes
System map
System map
IRALOGIX
Logixian
get signing keys
Workers, no database access
External services
request · async delivery · component · data store · outside Logixian
Questions
What stops the AI from publishing a wrong rule?
The agent has no write path. It can read the rules and sources, and it can propose a candidate. Each candidate runs representative answers through the real engine, and failures go back to the agent for repair. A passing candidate is only staged for side-by-side comparison.
A legal specialist applies it, and approval is a separate step that checks the cited sources again. The gate checks that the evidence is current. It does not guarantee legal correctness.
Source evidence and approval
| Result | Meaning | Next step |
|---|---|---|
| Activated | Every source matched and its evidence is stored. | New sessions may use the active version. |
SOURCE_CHANGED | Cited source text changed. | Regenerate from current sources. |
SOURCE_UNREADABLE | A source is gone, outside the allow list, or missing its main content. | Fix or replace the source, then regenerate. |
| Temporary failure | Capture failed, upload failed, or the attempt timed out. | Retry approval. |
What happens when a source changes after a rule is drafted?
At approval, the worker fetches each cited source again and compares it with the snapshot used during generation. If any source changed, approval is blocked and there is no override. The new version stays pending, the version already live stays live, and the specialist regenerates from the current sources.
Bundle lifecycle
Generation run
cancel, fail or no change → Draft
fails: retry or regenerate → Draft
Why are employer assessments deterministic?
AI helps write and repair the rules in the workspace. Once a rule is approved, the engine that runs an employer's assessment makes no model call and no external fetch. The same answers and the same rule version always give the same result, and a session keeps the version it started with.
Agent work belongs before approval, where a person reviews it.
Deterministic engine modules
API server
Engine library, pure, no I/O
uses · pure function, no I/O · module · data store · Paths are relative to api-server/api_server/ and logixian-lib/logixian_lib/
How does the workspace run a generation?
A legal specialist chats with an agent hosted on Amazon Bedrock. Confirming a plan freezes one generation request in the API queue. A worker claims it and returns one of four named outcomes: candidate, no change, needs input, or failed. Naming every outcome makes each run auditable, and lets the workspace treat "nothing to change" as a normal result.
Agent workspace and worker boundary
API server
Agent worker, one pod
request · dispatch, then callbacks through the API's internal routes · job · data store · outside the component
What happens inside a generation run?
A run moves through statute research, enrichment, audit, and quote checks, then builds a candidate. The candidate runs through the real engine, and any finding goes back to the same agent for repair. Repeated failures or an exhausted repair budget end the run without a draft to review.
Generation pipeline
Check → Enrichment: repair, up to 3, then fail
Validate → Audit: repair, up to 3, then fail
agent phase, Claude on Bedrock · deterministic step · data · repair loop
How do other systems call it?
Everything goes through one API: the review Portal, agents over MCP, IRALOGIX systems, and internal jobs. The API verifies each caller's token, then looks up what that client may do in a local registry. A client can be limited or turned off without waiting for a token to expire. Outbound webhooks are signed.
Two trust paths, one authorization model
Callers → Credential
Verify → Authorize → Route
Authentication proves the caller. Registry data grants or revokes power.