agentleFS
TrueImmortal82TrueImmortal82/open-code-skills/skills/assistant-runtime-architecture/SKILL.md

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.

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
  1. Distinctive:

    Read the relevant reference before changing runtime code.

    line 20
  2. Distinctive:

    When an output bug appears, walk top-down and stop at the first divergence:

    line 25
  3. Distinctive:

    Durability before acknowledgement: Never ack an inbound message until its transaction is committed.

    line 44

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

FailureRuleDetail
Child dies seconds after a voice replyevery nested subprocess must detach stdinreferences/process-topology.md
Reply stored, then changed by a background jobstored rows are append-only; the pipeline owns contentreferences/turn-pipeline.md
Model calls itself masculine, then "the fix" breaks correct textrepair only trusted frames; keep repairs idempotentreferences/russian-gender-contract.md
«согласен» flips to «согласна» at randominspect the live pipeline and projection first, never the corpusreferences/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:

  1. Candidate text — log the raw model output before any post-processing.
  2. Contract layer — what did the output-contract pipeline change, and why? Log a token-level diff of every rewrite.
  3. Turn transaction — is tx.response_text the same string as step 2's result? A mismatch here is a serialization or mutation bug.
  4. Projection — is messages.content byte-identical to tx.response_text? If not, something is rewriting stored rows. That is almost always the bug. Do not go read the corpus.
  5. 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.content is 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.