Skip to content

Codify Nemo's strategies as skills with Strategy Registry seeding#169

Merged
seamus-brady merged 1 commit intomainfrom
feat/orchestration-strategies-and-seeding
Apr 26, 2026
Merged

Codify Nemo's strategies as skills with Strategy Registry seeding#169
seamus-brady merged 1 commit intomainfrom
feat/orchestration-strategies-and-seeding

Conversation

@seamus-brady
Copy link
Copy Markdown
Owner

Summary

Final PR of the sub-agent-resilience plan. Implements Fix 5: codifies the four orchestration strategies Nemo registered locally as skill content + Strategy Registry seeding, so every fresh instance has the floor patterns at boot rather than re-discovering them through CBR.

Together with PR #166 (truncation guard + auto-save) and PR #167 (referenced_artifacts + checkpoint), this closes the loop on the 2026-04-26 incident.

What changed

Two new skills

  • .springdrift_example/skills/orchestration-large-inputs/SKILL.md — covers reconnaissance-first, search-then-read, and parallel-after-reconnaissance. Targets the cog loop (agents: cognitive) for orchestration decisions on large inputs.
  • .springdrift_example/skills/when-to-use-writer/SKILL.md — covers synthesise-in-root judgment. Explicit "use writer when" / "synthesise directly when" criteria with the 2026-04-26 lesson written in.

SkillSeeded strategy source variant

  • New variant on StrategySource distinguishes skill-derived floor strategies from operator-curated (OperatorDefined), CBR-mined (Proposed), and agent-observed (Observed) ones.
  • Encode/decode pair in strategy/log.gleam updated.
  • The 4-variant tag is meaningful for telemetry — operators can see at a glance what came from where.

Boot-time seeding

  • New src/strategy/seed.gleam module:
    • floor_strategies() — pure function returning the four (name, description, tags) triples
    • build_seed_events(now) — turns the triples into StrategyCreated events
    • seed_if_empty(dir) — writes the events to disk only when the registry has zero events; idempotent across boots
  • Wired into springdrift.gleam boot path next to librarian.init_captures.
  • Operator-curated strategies and CBR-mined Proposed strategies are never overwritten — the seed only fires on a genuinely empty registry.

Plan moved to implemented

docs/roadmap/planned/sub-agent-resilience.mddocs/roadmap/implemented/sub-agent-resilience.md with a "What Shipped" preamble that documents all five fixes across the three PRs.

Test plan

  • gleam build clean, no warnings
  • gleam test — 2083 passed (9 new), no failures
  • floor_strategies includes all four expected strategies
  • All four have non-empty descriptions and the orchestration tag
  • seed_if_empty writes 4 strategies to an empty registry; the resolved registry contains them with source: SkillSeeded
  • seed_if_empty on a populated registry returns 0 and does NOT overwrite existing entries (regression test seeds an OperatorDefined entry first, then asserts it survives)
  • Repeated seed_if_empty calls are idempotent — second call returns 0, total entries stays at 4
  • Both skill files exist on disk and are readable
  • Operator: delete .springdrift/memory/strategies/ on a fresh deployment, restart, verify the four floor strategies show up in <strategies> block of the sensorium on the first cycle

Notes for review

  • The seeded strategies reference patterns documented in the new skill files. Both must ship together — if a future change deletes a skill file but leaves the seeding, agents see strategy names pointing at nothing. The skill-files-exist tests guard the pairing.
  • SkillSeeded source vs. OperatorDefined is a deliberate distinction. An operator who reads .springdrift_example/skills/ and copies the patterns into their own config still creates OperatorDefined entries (different intent, different telemetry). The codebase-shipped floor stays as SkillSeeded so the provenance is clear.
  • seed_if_empty runs at boot regardless of whether the strategy registry is configured-enabled — it's idempotent and cheap, and registries that remain disabled won't surface the strategies in the sensorium anyway. Keeps the boot path simple.

🤖 Generated with Claude Code

… 3 of sub-agent-resilience)

Final PR of the sub-agent-resilience plan (Fix 5). Closes the loop:
fixes 1-4 gave us runtime resilience; this fix codifies the
orchestration patterns Nemo registered locally as skill content +
Strategy Registry seeding so every fresh instance has the floor
strategies at boot rather than re-discovering them through CBR.

Two new skills, four floor strategies seeded automatically.

Skills:
- .springdrift_example/skills/orchestration-large-inputs/SKILL.md
  covers reconnaissance-first, search-then-read, parallel-after-
  reconnaissance. Targets the cog loop for orchestration decisions
  on large inputs (long documents, multi-document comparisons).
- .springdrift_example/skills/when-to-use-writer/SKILL.md
  covers synthesise-in-root judgment. "If you can imagine writing
  the response yourself in 200-500 words of structured points,
  do it" — explicit anti-overuse criteria for the writer agent.

Strategy Registry seeding:
- New SkillSeeded variant on StrategySource (with encode/decode
  pair updates in strategy/log.gleam). Distinguished from the
  existing Observed/Proposed/OperatorDefined for telemetry.
- New src/strategy/seed.gleam: floor_strategies() returns the four
  (name, description, tags) triples; build_seed_events() turns
  them into StrategyCreated events; seed_if_empty(dir) writes the
  events ONLY when the registry has zero events.
- Idempotent: never overwrites an already-populated registry.
  Operator-curated and CBR-mined strategies are never disturbed.
- Wired into springdrift.gleam boot path next to
  librarian.init_captures so it runs early in instance startup.

Sub-agent-resilience plan moved from
docs/roadmap/planned/sub-agent-resilience.md to
docs/roadmap/implemented/ with a "What Shipped" preamble
documenting all five fixes across PRs #166, #167, and this one.

Tests: 9 new in test/strategy/seed_test.gleam covering:
- floor_strategies returns all four with descriptions and
  orchestration tags
- seed_if_empty writes four to an empty registry
- seeded strategies carry SkillSeeded source variant
- seed_if_empty is no-op on populated registry (operator strategies
  preserved)
- repeated seed_if_empty calls are idempotent (no double-seed)
- skill files exist on disk

Suite at 2083 passing (24 new across the three sub-agent-resilience
PRs on top of the 2059 baseline before PR #166).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@seamus-brady seamus-brady merged commit b944e8e into main Apr 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant