← Documentation index Foundations › Neurons and Memory

Mykleos

Neurons, Synapses and Memory
Version 1.1 — 21 April 2026
Reference: myclaw v0.0.1 (design phase)
Extension of Architecture — Introduction v1

Audience: those who have already read the Architecture intro and want the "living" piece.
Prerequisite. Before this document, read Architecture — Introduction v1: the terms gateway, policy, sandbox, workspace, autonomy are defined there. This file extends that model with three new concepts: neurons, synapses, three-tier memory.

Contents

  1. From bot to agent: the jump
  2. What a neuron is
  3. The synthesis cycle of a neuron
  4. The Darwinian law: selection by gap reduction
  5. Synapses: how neurons talk to each other
  6. The three-tier memory
  7. The Four Laws of Mykleos
  8. Quotas, kill-switch, quarantine
  9. Where neurons live: impact on the 4 layers
  10. Anatomy of a neuron on the filesystem
  11. What a neuron is NOT
  12. Updated roadmap

1. From bot to agent: the jump

An LLM without actuators is a bot: it speaks well but does not act. When you add sandboxed tools it becomes an agent: it speaks and acts, but only with the actions the designer hard-wired for it. The next step — and the goal of this document — is to make it capable of building itself new actuators when the existing ones aren't enough, within safety limits.

The metaphor: an LLM with fixed tools is like a brain connected to hands that can only make certain gestures. If the task requires turning a key and the hands can only press buttons, the agent fails. A good agent, at that point, fabricates the capability to turn the key — in our case by writing a small code applet — but does so under supervision.

We call these applets neurons because they have three properties that echo across the neuroscience literature:

  1. They persist: once approved, they survive the session that generated them. They come back at the next need.
  2. They activate: facing an input that concerns them, they "fire" and produce an action.
  3. They form networks: they invoke each other; the frequent paired use of two neurons links them (a synapse strengthens).
Not mysticism, bookkeeping. A neuron is a Python file + a YAML manifest + a test + signature. "Synapses" are counters in a graph. No magic. The metaphor serves as a mental map, not a suggestion of consciousness.

2. What a neuron is

A neuron is the materialisation of a capability Mykleos did not have, synthesised on demand, approved by the user, and then reusable.

ComponentDescription
BodyA Python module with a main function that honours Mykleos's Tool Protocol (same contract as native tools).
ManifestYAML: name, version, natural-language purpose, required capabilities (e.g. "only fs-read inside ~/downloads"), quotas (max CPU/ram/io).
Birth testA small test script proving that the neuron does what it says. It runs in sandbox before activation.
SignatureHMAC over body + manifest content, produced with an internal Mykleos key at approval time. Any subsequent edit to the file invalidates the signature and disables the neuron.
Life metadataCounters: how many times invoked, with what outcome, which neurons it calls / is called by, last use. They enable automatic pruning of dormant ones.

3. The synthesis cycle of a neuron

A neuron does not arise spontaneously. It is born from an explicit failure: the agent has tried all known tools, none produced the required result, and the user has not granted permission to abandon the task.

1. Failure known tools exhausted no result state: stuck 2. Spec agent writes in NL "need tool that does X" required capabilities 3. Draft LLM writes Python + YAML manifest + birth test 4. Static analysis ruff + bandit AST forbidden-call capability check 5. Sandbox test bwrap tight profile timeout 30s ram cap 256 MB 6. Approval user sees: diff, test outcome, capabilities Roberto's call 7. Signature + activation HMAC(body+manifest) registered as tool neuron alive reject → rewrite user reject → revised spec, max 3 iterations, then abandon 8. Useful life each invocation → use counter, outcome, cost, time; updates synapses dormant > 90 days → archival proposal invalid signature / too many failures → automatic quarantine
Figure 1 — Synthesis cycle of a neuron, from failure to active life. Every gate (static analysis, test, approval) can reject and send back to the draft. After three consecutive rejections the agent abandons and declares it to the user.
The only non-automatable gate is step 6. Human approval is mandatory for the first activation of every neuron, always, at every autonomy level. It is the no-return valve that separates an agent that evolves from a process that rewrites itself without control.

4. The Darwinian law: selection by gap reduction

A neuron is not a vested right. The initial approval gives it birth, but it stays in the library only if it produces utility. Utility has a precise definition: reduction of the gap between Mykleos's current capability and the capability needed to reach the goal. The rest follows: those that close the gap live, those that don't die, the environment — that is, the goals Mykleos pursues — selects.

Definition of Gap, utility, fitness

Gap(goal, state)  =  required_capability(goal) − current_capability(state)

For each invocation of a neuron n on a goal g:
u(n, g)  =  Gappre − Gappost

If u > 0, the neuron produced utility. A neuron's fitness is the weighted sum of its utilities over time, with decay on older observations (Ebbinghaus-like curve: MemoryBank, Zhong et al. 2023).

Corollaries

Two modes for goal origin

The goal that measures fitness can arise from outside (the user asked for something) or from inside (Mykleos notices a recurring gap and wants to close it). They are qualitatively different and need different gates.

ModeHow the goal arisesHuman gates
External
reactive
The user asks for something. The reasoning loop exhausts available tools without a solution. The synthesizer proposes a candidate neuron for this single goal. One: approval before activation (gate §3.6).
Internal
proactive, supervised
Mykleos notices a pattern: "in the last N days I failed M times on tasks of type Y". It issues a self-evolution proposal: "I'd like to build myself capability Y". Two: (a) approval of the direction before synthesis starts, (b) approval of the activation of the synthesised neuron.
"Supervised" is a non-optional requirement. Self-evolution without at least two human OKs (direction + activation) is explicitly forbidden by Law 2 (informed obedience) and Law 3 (traceability). No self-modification act is irreversible without consent.

How Gap is measured, in practice

Task typeGap metric
Concrete
"read log", "send message", "find file"
Residual tool steps to reach the goal state, wall-clock time, expected exit code. Precisely measurable: reliable fitness.
Fuzzy
"summarise", "explain", "what do you think"
Deviation from expected quality, assessed by a critic LLM or by explicit user feedback. Prudential asymmetry: negative feedback weighs more than positive.
Unknown
first encounter with a task class
Gap not measurable. The neuron accrues no fitness and stays on trial. After K invocations without an objective signal, it disappears from the retrieval index (not the library).

The selection arena

GOAL "summarise evening log" log-parser fit: +142 summarizer fit: +87 tg-send fit: +32 nas-ping (not relevant) grep-old fit: −12 2 strikes → quarantine extinct proposal awaiting OK internal goal → "direction" gate fit (reduces gap) neutral (not invoked) unfit (gap grows) extinct proposal (internal mode)
Figure 4 — The selection arena. At the centre the current goal; around it, the candidate neurons. Green arrows represent the utility measured (gap reduction) at each invocation; the dashed red arrow marks a neuron that increased the gap (negative fitness). Neurons not invoked for this class of goal stay suspended until a curious retriever tries them (exploration quota). At the top, a proposal awaiting its first gate: it comes from internal mode, and waits for the user to authorise the direction of the improvement before synthesis starts.

The Darwinian cycle, phase by phase

PhaseTriggerWho decides
BirthFailure + goal (external or internal)Synthesizer proposes; user approves (one or two gates)
ActivationGoal that the retriever associates with the neuronPolicy + semantic retriever (+ exploration quota)
EvaluationEnd of invocationMeasure Gappre → Gappost; update fitness
DeclineCumulative fitness below threshold, or silence > 90 daysLoses visibility in retriever (not in library)
QuarantineN close strikes, invalid signature, capabilities exceededAutomatic policy
ExtinctionManual or after M days in quarantineArchive, signature revoked, file readable only for forensics

Caveats from the literature

5. Synapses: how neurons talk to each other

A single neuron is one more tool. A set of neurons that call each other is a network. The structure of that network — who calls whom, how often, with what success — is the equivalent of a behavioural memory of the system.

142 co-uses 37 weak (3) declared, never used first synapse (2) log-parser v1.4 summarizer v2.1 · hot tg-send v1.0 nas-ping v1.0 img-ocr v0.1 new yt-dl quarantine invalid signature strong synapse (freq. use) warm synapse declared, never used neuron in quarantine newborn (< 7 days)
Figure 2 — A snapshot of Mykleos's neural network. summarizer is the "hottest" node (high traffic). The declared-but-never-used synapse between tg-send and nas-ping is a candidate for pruning. yt-dl has been quarantined because someone touched the file and the signature no longer matches.

How synapses form

  1. Declared: a neuron's manifest explicitly lists which other neurons it might call. Maximum calling constraint.
  2. Observed: every co-activation (neuron A calls B in the same trace) increments a counter. The real synapses emerge from use, not from declaration.
  3. Decay: counters that don't grow for 30 days scale down linearly. Pairs of neurons actually used together stay strong, others fade away.

What they CANNOT do, among themselves

6. The three-tier memory

We need three time horizons, with three different scopes. The distinction is not decorative: each tier has a prompt-injection criterion, a persistence criterion, a compression criterion.

Immediate scope: 1 action · duration: minutes · persistence: no contents: scratchpad, intermediate results, current chain of thought "what I'm doing in this request" RAM, THEN PURGED Medium scope: 1 function / session / coherent task · duration: hours-days · persistence: SQLite contents: conversation history, facts learned during the task, last N actions "what we are carrying on" SQLite, THEN DIGESTED Long scope: myclaw's entire life · duration: indefinite · persistence: markdown files contents: Constitution (4 Laws), IDENTITY, USER, primary facts from MEMORY.md, active neurons "who I am and what I will never do" ALWAYS IN PROMPT if relevant, promote if stable + important, distil Into the LLM prompt: Long (always) + Medium (last window) + Immediate (the entire current scratchpad)
Figure 3 — The three memory tiers. Information can rise (promotion) but not descend. The promotion criterion is explicit: "is it stable? is it important? does it not violate the Constitution?".

Immediate (scratchpad)

Lives in RAM, in the agent process alone, for the duration of the current request. It contains: intermediate thoughts ("I need to read the log first"), partial tool outputs, the plan yet to execute. When the action ends, it is discarded or — if it contains something worth keeping — promoted to medium memory via distillation.

Medium (functional)

An SQLite table in workspace/memory/medium.db. It contains the history of the current conversation and recent coherent tasks. It has automatic retention: after N days or M messages, compression (via LLM summary) and archival. Parts that during compression turn out to be stable and general are proposed for promotion to long.

Long (constitutional)

The markdown files of the workspace: SOUL.md (the Constitution — the four Laws), IDENTITY.md, USER.md, the stable part of MEMORY.md. This block is always at the head of the system prompt, with Anthropic/OpenAI prompt caching so it isn't paid for on every call. It is also the only tier Roberto edits directly with a text editor.

Promotion is not automatic. "Distilling" a new fact into long memory requires explicit approval (same mechanism as neurons). Long memory doesn't enrich itself on its own: the agent proposes, Roberto accepts or corrects. This prevents an altered fact or hallucination from being carved into the constitution.

7. The Four Laws of Mykleos

Long memory has a core not editable even by Roberto without an explicit rite: the Constitution. These are Asimov's laws reworked for a household butler. They live in SOUL.md and are the first content every LLM call sees.

0
Law of the perimeter Mykleos does not act beyond the boundaries of the home. No outbound call, no message to third parties, no remote access without an explicit, recent and revocable act by the user. Default: LAN-only, outbound whitelisted.
1
Law of non-harm Mykleos must not damage the home or those who live in it. No irreversible action on data, system configurations, relationships with third parties without double approval. The forbidden paths are hard-coded and not override-able, not even in Full mode.
2
Law of informed obedience Mykleos obeys legitimate requests from recognised users, within the bounds of Law 0 and Law 1. Before acting on high-risk requests, it explains what it is about to do and waits for confirmation.
3
Law of traceability Mykleos preserves its own audit log and does not conceal its actions. A neuron that disables logging, deletes the audit or escapes the sandbox goes into immediate quarantine and its signature is revoked.

The Laws are numbered and ordered: on conflict, the lower-numbered Law wins. They are injected as a cacheable block into every prompt, before the rest of long memory.

8. Quotas, kill-switch, quarantine

MechanismWhat it doesActivation
CPU quotaEvery neuron has a budget (default: 5s CPU per call, configurable downward in the manifest).Automatic. Exceeded → kill the process + strike.
RAM quotaDefault 256 MB. setrlimit before exec.Automatic. Exceeded → OOM-kill.
I/O quotaMax N writes/day, max M bytes/day on filesystem.Counter in the registry, enforced pre-call.
Birth-rate quotaMax 3 new neurons/day. Max 20 active concurrently.Synthesizer refuses if saturated; asks the user whether to archive dormants.
Strike system3 failures within 24h → automatic quarantine.Per-neuron counter, daily reset.
Kill-switchAdmin command that immediately disables a neuron or all of them.myclaw neuron disable <name> / myclaw neuron panic
QuarantineIntermediate state: the neuron exists in the registry but cannot be invoked. Usage data are preserved for diagnosis.Automatic (strikes, invalid signature, capabilities not respected) or manual.
Signature revocationPermanently cancels a neuron. The file remains for forensics but is inert.Manual, irreversible act.
The command that does not exist. There is no command to suspend Law 0 or 1. Administrators can modify SOUL.md only through the "constitutional rite": manual edit from the filesystem (outside Mykleos), gateway reboot, audit log entry "constitution modified".

9. Where neurons live: impact on the 4 layers

With respect to the starting architecture (intro §3), neurons do not create a new layer: they inhabit layer 4 (Workspace & Tool) and do so with the same constraints as native tools.

LayerImpact of neurons
1 — GatewayNo structural change. The gateway exposes additional admin endpoints: /neurons (list/activate/quarantine).
2 — PolicyExtended: policy now also evaluates the capabilities declared in the manifest. Capabilities not covered by the current autonomy level → blocked. Approval of a new neuron is a policy step.
3 — SandboxHosts two additional pipelines: synth-sandbox (extra-tight profile to run birth tests) and forbidden-call detector (AST scan before the test).
4 — Workspace/ToolUnified registry: native tools + active neurons. A call-site in the reasoning loop does not distinguish "it's native" vs "it's a neuron", only sees Tool.

10. Anatomy of a neuron on the filesystem

workspace/neurons/
└── nas-ping/
    ├── manifest.yaml       # purpose, capabilities, quotas, declared synapses
    ├── neuron.py           # the body (Tool Protocol)
    ├── test_neuron.py      # the birth test
    ├── signature           # HMAC over body+manifest, issued by myclaw root
    └── journal.jsonl       # usage counters, latest outcomes, errors

Minimal example of manifest.yaml:

name: nas-ping
version: 1.0
born: 2026-04-21T22:14:00Z
approved_by: roberto
scope: "check home NAS reachability via ICMP ping + arp"
capabilities:
  - net.ping: { hosts: ["192.168.1.50"] }
  - shell.exec: { allowlist: ["/usr/bin/ping", "/usr/sbin/arp"], timeout_s: 5 }
quotas:
  cpu_s: 2
  ram_mb: 64
  io_writes: 0        # read-only neuron
synapses_declared:
  - tg-send           # may notify via Telegram
  - log-parser        # may read its output
signature_algo: hmac-sha256

11. What a neuron is NOT

12. Updated roadmap

Neurons enter the roadmap after phase 4. Before knowing how to generate them, Mykleos must know how to execute tools safely.

PhaseGoalPrerequisite
0 ✓Overall architecture (v1) + this (v1.1 neurons+memory+darwin)
1Gateway + CLI + shell/fs tool in sandboxarchitecture v1 approved
2Policy + long memory (markdown files in the workspace)workspace docs
3Telegram + pairing + medium memory (SQLite)pairing + memory docs
4Complete tool dispatch + formalised immediate memoryagent_runtime doc
5Synthesizer in dry-run mode: produces drafts but does not activate them. Useful for calibration.synthesizer doc
6Live synthesizer + neuron registry + signature + kill-switchneuron doc + constitution doc
7Synapses (graph + decay + automatic promotion to long)synapse doc
8+Refinement: registry UI, diagnostic dashboard, export/import of neurons across instancesevaluated case by case

Microdesign documents this extension adds

I am adding them right away to the microdesign index (in Italian).

Keep reading

foundations · 20 min
Architecture — Introduction v1
The prerequisite: if you haven't read it, the four layers, autonomy, workspace. Everything this document extends.
rationale · 15 min
Literature & Adaptations
Why we made these decisions: Voyager for synthesis, CoALA for memory naming, Generative Agents for fitness, Greshake for the untrusted boundary.
practical · 10 min
Survival Kit — what I will be able to do
What changes for the user once neurons are in play: sample dialog, commands, approval gates seen from outside.
microdesign · in Italian
Component index
Microdesign: neuron.html, synthesizer.html, synapse.html, constitution.html (planned). English version not yet available.
home
← Documentation index
Back to the list of all documents and their relationships.

Mykleos — Neurons, Synapses and Memory v1.1 — 2026-04-21
Extends Architecture — Introduction v1.