Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 73 additions & 40 deletions .agents/skills/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,84 @@
This directory contains repo-local copies of canonical skills from
`The-Interdependency/skill-lib`.

Source commit: `38c64332b840b2bbe1c07e53aeee8996644548e9`
Source commit: `321e721fb660e0fea5bb8c37d943611963039a57`

Repo-local copies are not the source of truth. Edit `skill-lib` first,
then propagate from the canonical source.

Skills refreshed from the source commit above:

- `wdll/`
- `a0p-instancing/`
- `action-calibration/`
- `agent-instantiation/`
- `canon/`
- `cap-build/`
- `char-compress/`
- `data-visualization/`
- `deps-build/`
- `distributed-publication/`
- `doc-build/`
- `domain-claims/`
- `epac-selection-display/`
- `explore-data/`
- `fresh-making/`
- `gonol-build/`
- `interdependent-work-graph/`
- `llms-build/`
- `loop-eng/`
- `manifest/`
- `meta/`
- `meta-module-build/`
- `msdmd/`
- `owner-build/`
- `plain-lens/`
- `project-incubation-graduation/`
- `ratios/`
- `repo-audit-repair/`
- `risk-boundary-build/`
- `skill-build/`
- `skill-usage/`
- `sql-queries/`
- `ssh-automation/`
- `statistical-analysis/`
- `test-build/`
- `the-interdependency/`
- `thought-lens/`
- `typed-meta-frontend/`
- `ucns-option-selection/`
- `validate-data/`
- `visitor-intro/`
- `vm-mcp/`

Other installed skills (not refreshed by this propagation):

Their existing files retain their own authority/provenance; the source
commit above does not assert that these copies were refreshed.

- `action-calibration/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `canon/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `cap-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `char-compress/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `data-visualization/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `deps-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `distributed-publication/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `doc-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `domain-claims/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `epac-selection-display/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `explore-data/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `fresh-making/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `gonol-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `interdependent-work-graph/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `llms-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `loop-eng/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `manifest/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `meta/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `meta-module-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `msdmd/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `owner-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `plain-lens/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `project-incubation-graduation/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `ratios/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `repo-audit-repair/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `risk-boundary-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `skill-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `skill-usage/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `sql-queries/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `ssh-automation/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `statistical-analysis/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `test-build/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `the-interdependency/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `thought-lens/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `typed-meta-frontend/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `ucns-option-selection/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `validate-data/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `visitor-intro/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]
- `vm-mcp/` [not refreshed; prior source: `38c64332b840b2bbe1c07e53aeee8996644548e9`]

## Lifecycle propagation usage

Read `agent-instantiation/SKILL.md` for a0/a0ucns and the a0p legacy copy;
read `a0p-instancing/SKILL.md` for a0-betatest backend. Load `wdll/SKILL.md`
when consequential spawned work needs its scope or completion proof resolved.
These are source-owned instructions, not evidence that EPAC deploys either runtime.

To reproduce this bounded refresh from skill-lib commit
`321e721fb660e0fea5bb8c37d943611963039a57`, run:

```sh
python tools/propagate_skills.py /path/to/epac --skills agent-instantiation
python tools/propagate_skills.py /path/to/epac --skills agent-instantiation --apply
```

The canonical dependency closure is `wdll`, `a0p-instancing`, and
`agent-instantiation`; no other skill refresh is implied. Full-library drift and
older MSDMD runtime/projection work remain separate. Preserve release locks,
scientific pins, sealed results, and accepted release-consumption evidence.

The scoped work graph is `docs/work-graphs/lifecycle-skills-321e721.json`.
The snapshot statements in `docs/PROVENANCE.md` and `docs/work-graph.json`
remain at their qualification-time identities because sealed join-term evidence
binds those exact bytes. This README and the scoped graph describe the current
lifecycle installation without rewriting that historical evidence.
30 changes: 4 additions & 26 deletions .agents/skills/a0p-instancing/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
---
name: a0p-instancing
description: Methodology for instancing agents in a0-betatest (the a0p research instrument), whose model diverges from canonical a0. Load this when adding or changing an AgentInstance / CharacterSheet CRUD path, a per-instance native ZFAE weight bank or its training/distillation loop, a ZFAE inference mode, a sentinel evaluation or pending-override gate, a per-agent safetensors checkpoint, or volatile sub-context memory — anywhere under a0-betatest `backend/`. Use it before writing code that creates, addresses, trains, runs, governs, or persists an a0p agent, so the code follows a0p's per-user CRUD + native-ZFAE + sentinel model instead of a0's spawn/fork/merge model. For canonical a0 and its mirror a0ucns, use `agent-instantiation` instead — a0p does NOT have `sub_agent_spawn`, a spawn executor, or `InstanceMerge`.
description: Agent instancing in a0-betatest backend (a0p). Load this when creating, addressing, training, running, governing, persisting, or changing AgentInstance/CharacterSheet CRUD, native ZFAE weight banks, teacher distillation, inference modes, sentinel evaluation, pending overrides, per-agent safetensors checkpoints, Mongo metadata, FIQ events, or volatile sub-context memory. Do not load for ordinary LLM-prompt work that creates no instance. For a0, a0ucns, or a0-betatest/_legacy_a0 use agent-instantiation/SKILL.md.
---

# a0p-instancing — How a0-betatest brings agents into being

a0-betatest (the **a0p** research instrument) replaced a0's single-persistent
+ fork model with a **multi-agent, per-user model**: an agent is a persistent
CRUD entity (`AgentInstance`) bound to an editable `CharacterSheet`, and each
instance **owns its own trained native ZFAE weight bank**. The LLM is optional
energy; once an instance's native core is trained, it can run with no LLM at
all. This skill captures that model so a coding agent extends it instead of
reaching for a0's spawn/fork/merge machinery, which **does not exist here**.

This skill is the **peer** of `agent-instantiation` (which documents a0 /
a0ucns). They describe genuinely different architectures; do not mix them.

## Load this when

- Adding/editing an `AgentInstance` or `CharacterSheet` **CRUD** path.
- Touching the **native ZFAE weight bank**, its **teacher-distillation
training**, or the native **inference** engine / modes.
- Adding/changing a **sentinel** evaluation or a **pending-override** gate.
- Persisting per-agent state (**safetensors checkpoints**, Mongo metadata,
**FIQ** audit events) or volatile **sub-context** memory.

Do not load this for canonical a0 / a0ucns work (use `agent-instantiation`),
or for ordinary LLM-prompt work that creates no instance.

## Scope and source boundary

The **canonical source is `a0-betatest/backend/`** (the a0p package per its
Expand All @@ -54,7 +31,8 @@ reproduce them from memory. Where a mechanism is unclear or unwired, write
**fresh per agent** at creation (`backend/agents/store.py`).

There is **one weight bank per agent**, not a shared singleton engine. Never
share or fork a bank between instances.
share or fork a bank between instances. A trained native core can run without
an LLM; the inference mode governs optional LLM energy.

## Instancing sequence (dependency order — follow it top to bottom)

Expand Down Expand Up @@ -82,7 +60,7 @@ share or fork a bank between instances.
or both produce/judge the reply. `zfae_native` refuses LLM fallback.
6. **Evaluate sentinels and honor the override halt** (`sentinel_eval.py`,
`sentinels.py`, `overrides.py`). Resolve per-agent sentinel modes/weights,
compute the `Verdict13`; on a blocking flag, create a `PendingOverride`
compute the `Verdict13` from 13 sentinels (S1–S13); on a blocking flag, create a `PendingOverride`
and **halt** until approved. Do not bypass the halt.
7. **Checkpoint to safetensors, not a DB blob.** Persist the bank to
`storage/agents/{id}/zfae_core.safetensors` (+ `…meta.json`: digest,
Expand Down
84 changes: 13 additions & 71 deletions .agents/skills/agent-instantiation/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,25 @@
---
name: agent-instantiation
description: Methodology for instantiating, forking, running, merging, and retiring agents in the a0 platform and its near-identical mirror a0ucns. Load this when adding or changing a sub-agent spawn path, a PCNA instance fork/merge, an agent definition or naming scheme, spawn caps or approval gating, an agent run/log table, a heartbeat-driven agent task, or a checkpoint of agent state. Use it before writing any code that creates, addresses, schedules, or tears down an agent or sub-agent, so the new code follows the platform's existing lifecycle, fork/merge, identity, and gating contracts rather than inventing a parallel one. NOTE — a0-betatest (a0p) has diverged to a different per-user CRUD + native-ZFAE instancing model — this skill's spawn/fork/merge sequence does NOT apply there; see "a0-betatest divergence".
description: Agent lifecycle for a0 and its near-identical mirror a0ucns. Load this when creating, addressing, scheduling, forking, running, merging, or retiring agents; changing sub-agent spawn paths, PCNA instance fork/merge/converge, agent definitions or naming, spawn caps, spawn executor or approval gating, agent_runs or agent_logs, heartbeat tasks, or checkpoints. Do not load for ordinary LLM-call/inference-prompt work that does not create or reshape an instance. For a0-betatest backend use a0p-instancing/SKILL.md; its _legacy_a0 reference copy follows this skill.
---

# agent-instantiation — How a0 brings agents into being

a0 runs **one persistent agent** (ZFAE) and lets it **fork sub-agents**
(`a0(model)zeta{n}`) that run in parallel and **merge back**. An agent is
not an LLM call: the LLM is an interchangeable *energy provider*, while the
agent *is* a `PCNAEngine` instance (six prime-indexed rings) plus its
identity, memory, run record, and checkpoint. This skill captures the
methodology a coding agent must follow so a new spawn path, ring fork, merge
mode, or agent definition plugs into the existing lifecycle instead of
growing a second, divergent one.

## Load this when

- Adding or editing a sub-agent **spawn** path, or any code that creates an
`agent_runs` row.
- Adding a **fork**, **merge**, or **converge** of a `PCNAEngine` instance.
- Defining a **new agent** (its name/symbol/slot/directives/tools) or
changing the **naming** scheme.
- Touching **spawn caps**, **approval gating**, or the **spawn executor**.
- Persisting agent state (**checkpoints**, **run logs**) or scheduling an
agent task on the **heartbeat**.

Do not load this for ordinary LLM-call/inference-prompt work that does not
create or reshape an agent instance.

## Scope and source boundary

The **canonical source is `a0`** (`python/engine/`, `python/services/`,
`python/agents/`, `shared/schema.ts`). `a0ucns` is a near-identical mirror and
follows this skill verbatim. **`a0-betatest` (a0p) has diverged** to a
different instancing model and does **not** follow the sequence below — see
"a0-betatest divergence" before touching that repo.
`python/agents/`, `shared/schema.ts`). For the a0p architecture and its
exceptions, load [a0p-instancing](../a0p-instancing/SKILL.md).
This is **repo-specific runtime doctrine**, not org-universal math: it
transfers no UCNS / PCNA / PCTA theorem status (see each repo's boundary
notes). Cite the a0 files below; if a mechanism is not in them, mark it
`hmmm` rather than inventing it.

## The model: persistent agent vs sub-agents

An agent is a `PCNAEngine` instance (six prime-indexed rings) plus identity,
memory, run record, and checkpoint. An LLM call supplies interchangeable energy.

- **Persistent agent (ZFAE).** Defined as a plain dict in
`python/agents/zfae.py` (`ZFAE_AGENT_DEF`: `name`, `symbol`, `slot`,
`directives`, `tools`, `sentinel_seed_indices`, `is_persistent`). Its
Expand Down Expand Up @@ -80,35 +58,36 @@ stream lives in `agent_logs`. Keep these three in agreement.
`get_pcna()` at lifespan startup; `await pcna.load_checkpoint()` to
restore learned ring state; ensure its row in the agent/instance table.
Do not construct a second primary.
3. **Spawn only through the `sub_agent_spawn` tool**
3. **Bind consequential spawned work to WDLL.** When the child receives a nontrivial objective whose target state, scope, or proof is not already explicit, apply `wdll/SKILL.md` before execution so the spawn owns a falsifiable state transition rather than a broad activity prompt.
4. **Spawn only through the `sub_agent_spawn` tool**
(`python/services/tools/sub_agent_spawn.py`). Never `INSERT` an
`agent_runs` row by hand. The tool checks spawn caps, derives
`root_run_id`/`depth` from the parent run scope, inserts the row
`status='running'`, and returns `{ok, agent_id, run_id}` immediately
(spawn is non-blocking).
4. **Fork the engine via `InstanceMerge.fork(parent)`**
5. **Fork the engine via `InstanceMerge.fork(parent)`**
(`python/engine/merge.py`) — returns `(child, meta)`. The child gets
independent tensors with small Gaussian noise (a0: σ≈0.02 on Φ/Ψ/Ω,
≈0.01 on Θ; Memory-L copied deterministically). Register it in
`_sub_agents` with `parent_id` + `run_id`. Never share tensor references
between instances.
5. **Execute via the spawn executor, not inline.** The background loop in
6. **Execute via the spawn executor, not inline.** The background loop in
`python/services/spawn_executor.py` claims one `running` row atomically
(`SELECT … FOR UPDATE SKIP LOCKED` in `spawn_db.py`), resolves the
provider, runs one turn, emits to `agent_logs`, and sets the terminal
status (with the row's retry policy on transient errors). Do not call the
model directly from the spawn path.
6. **Merge with `InstanceMerge.absorb(parent, child)`** when the child's
7. **Merge with `InstanceMerge.absorb(parent, child)`** when the child's
work is done — federated averaging blends the rings (a0: donor α≈0.15 on
Φ/Ψ/Ω, ≈0.8 on Memory-L). Then unregister the child, mark its row
`merged`, and archive its log stream. Use `fork`/`absorb` for the
parent⇄child path; `converge(a, b, α)` only for two live peers that both
continue.
7. **Persist on a cadence, validate on restore.** Save ring tensors to the
8. **Persist on a cadence, validate on restore.** Save ring tensors to the
checkpoint store (a0: base64 in `system_toggles`) from a **heartbeat
task**, not ad hoc; on load, validate every ring's shape and assign
nothing if any mismatches (all-or-nothing restore).
8. **Gate every mutation.** Manual spawn/merge routes call
9. **Gate every mutation.** Manual spawn/merge routes call
`require_admin(request)` (or are listed in the gating allowlist with a
justification). Tools that cause side effects honor the approval scope
(`get_approval_scope_user_id()`); spawn caps and parent run scope ride
Expand Down Expand Up @@ -149,10 +128,6 @@ username( a0( <energy / inference provider> ) <auditor / teacher / …> )
| `a0(zfae)` | native ZFAE engine | — |
| `a0(zfae)gpt 5.5` | native ZFAE engine | gpt 5.5 (teacher / auditor) |

Energy is inside the parens, auditor is outside, the user wraps the whole
thing. `zfae` *inside* the parens means native inference is the energy — it
is not an auditor.

> Reconciliation note (`hmmm`): a0's current code emits a different,
> pre-nomenclature form — `compose_name(...)` → `a0({model})zfae` and
> `sub_agent_name(index, ...)` → `a0({model})zeta{index}` — where the trailing
Expand Down Expand Up @@ -199,39 +174,6 @@ is not an auditor.
- Skipping `require_admin` / approval-scope checks on a new spawn or merge
surface.

## a0-betatest divergence (does not follow this skill)

`a0-betatest` (a0p) replaced the a0 model wholesale. Do **not** apply the
spawn/fork/merge sequence there; its instancing is:

- **An instance is a per-user CRUD entity, not a forked singleton.**
`AgentInstance` (UUID + editable `CharacterSheet`) created/read/updated/
archived via routes — `backend/agents/{schema.py,store.py,routes.py}`.
There is no single persistent `PCNAEngine`; each agent is its own entity.
- **Each instance owns a native ZFAE weight bank**, not shared ring tensors:
three 157-seed cores `[157,53,7,7]` (1,223,187 scalars), `A0ZFAEWeightBank`
in `backend/interdependent_lib/zfae/weights.py`; the native engine refuses
LLM fallback in `zfae_native` mode and trains by teacher distillation.
- **No `sub_agent_spawn`, spawn executor, or `InstanceMerge`.** The only
"spawn/merge" is volatile in-memory sub-context scoping —
`MemoryCore.spawn_sub` / `merge_sub` in
`backend/interdependent_lib/pcna/memory_core.py`. No ring/weight forking,
no federated averaging, no `agent_runs` state machine.
- **Identity is a UUID + character-sheet name**, per `user_id` — not the
`a0(model)zfae` / `zeta{n}` naming convention.
- **Persistence is filesystem + Mongo + FIQ**, not `system_toggles` /
`agent_logs`: per-agent `storage/agents/{id}/zfae_core.safetensors` (+ meta
JSON), agent metadata in the Mongo `agent_instances` collection, and a
hash-chained **FIQ audit log** for events.
- **Gating is sentinel + override**, not spawn caps + ContextVars: 13
sentinels (S1–S13) with per-agent modes/weights and a pending-override
halt gate, plus `MODULE_BUILD`/`BOUNDARIES`/`CAPABILITIES`/`RATIOS`
enforced by the vendored `a0p_skills` runners.

`a0-betatest/_legacy_a0/` is a reference copy of canonical a0 (which *does*
follow this skill). If a0-betatest's per-instance native-ZFAE model needs its
own doctrine, it belongs in a **separate** skill, not by stretching this one.

## hmmm

- a0's `fork()` seeds its RNG from `time.time()`; rapid successive forks can
Expand Down
Loading
Loading