assistant-runtime-architecture
Skill0 starsChanged 41 days agoMITView on GitHub
Architecture and debugging runbook for a long-lived personal/companion AI assistant — GUI supervisor + runtime child over a stdin pipe (QProcess, supervisor_lost), durable turn/delivery transactions with prepare_delivery/complete_delivery and message projection, output contracts and voice/TTS (subprocess stdin=DEVNULL), and morphological Russian gender enforcement via pymorphy3 clause stacks. Use when designing an assistant runtime, wiring a supervisor to a child process, adding durable message delivery, building output post-processing, or debugging stored-history corruption, spurious shutdowns, or gender/addressing errors («согласен» vs «согласна») in a Russian-language assistant.
In this repository19 other files it gives its agents.
- api-doc-recallSkill
- code-disciplineSkill
- english-requestSkill
- github-repo-opsSkill
- git-safetySkill
- long-task-continuitySkill
- opencode-config-authoringSkill
- opencode-tool-outputSkill
- powershell-windowsSkill
- provider-reconnectSkill
- reference-booksSkill
- release-checklistSkill
- research-synthesisSkill
- self-improvementSkill
- skill-authoringSkill
- subagent-delegationSkill
- task-closureSkill
- test-first-fixSkill
- troubleshooting-treeSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Read the relevant reference before changing runtime code.
- Distinctive: line 25
When an output bug appears, walk top-down and stop at the first divergence:
- Distinctive: line 44
Durability before acknowledgement: Never ack an inbound message until its transaction is committed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Assistant runtime — architecture & debugging runbook
A production assistant of this shape is three tiers: a supervisor GUI, a runtime child process, and a messaging gateway. Most production incidents in this design come from four places, each documented below with the rule that prevents it:
| Failure | Rule | Detail |
| Child dies seconds after a voice reply | every nested subprocess must detach stdin | references/process-topology.md |
| Reply stored, then changed by a background job | stored rows are append-only; the pipeline owns content | references/turn-pipeline.md |
| Model calls itself masculine, then "the fix" breaks correct text | repair only trusted frames; keep repairs idempotent | references/russian-gender-contract.md |
| «согласен» flips to «согласна» at random | inspect the live pipeline and projection first, never the corpus | references/diagnostics.md |
Read the relevant reference before changing runtime code. Each one ends with the incident that produced the rule.
Diagnostic order (use this first)
When an output bug appears, walk top-down and stop at the first divergence:
- Candidate text — log the raw model output before any post-processing.
- Contract layer — what did the output-contract pipeline change, and why? Log a token-level diff of every rewrite.
- Turn transaction — is
tx.response_textthe same string as step 2's result? A mismatch here is a serialization or mutation bug. - Projection — is
messages.contentbyte-identical totx.response_text? If not, something is rewriting stored rows. That is almost always the bug. Do not go read the corpus. - Only then the corpus — to measure blast radius, never to guess a cause.
Background jobs that mass-rewrite stored messages with heuristics are the
prime suspect for "the text is wrong at rest but right in the log". If a
rewrite is not idempotent and not anchored to a specific known-bad message,
delete it. See references/turn-pipeline.md.
Hard rules
- Durability before acknowledgement. Never ack an inbound message until its transaction is committed. Recovery must be able to replay generated-but-undelivered runs.
- The projection is authoritative.
messages.contentis written once, from the committed transaction, verbatim. - No regex word-mutation over stored text. Heuristics that rewrite words corrupt natural speech and quoted text.
- Repairs are idempotent.
f(f(x)) == f(x)must hold for every output transform. Assert it in tests. - Every incident ends with a regression test named after the failure, plus a note in the project's agent instructions. Do not re-enable removed behavior without its guard.
Reference map
references/process-topology.md— supervisor/child split, death detection, event stream, the stdin-inheritance trap, secrets handling.references/turn-pipeline.md— the turn spine, durable transactions, prepare/complete delivery, projection, recovery.references/output-contracts.md— contract pipeline layers, soft vs hard violations, repair dispatch.references/russian-gender-contract.md— pymorphy3-based morphological gender, clause-stack tracking, strict mode, repair guards, known false positives.references/diagnostics.md— corpus auditing, idempotency checks, regression-test discipline.references/reference-implementation.md— a worked example codebase mapping each pattern above to real files, for when you want a concrete reference.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

