Rules — project + global conventions (like Claude Code rules)
Drop markdown rule files and every dispatched task gets them injected as a RULES preamble
(instructions), ahead of the MEMORY preamble (context) and the task — so cyberine follows your
conventions when run standalone:
mkdir -p ~/.cyberine/rules && echo "Prefer Bun over npm for new scripts." > ~/.cyberine/rules/style.md # global, all projects
mkdir -p .cyberine/rules && echo "Never edit files under src/generated/." > .cyberine/rules/repo.md # this project only
cyberine run --bg "add a small script" # the worker now sees both rule filesGlobal rules (<CYBERINE_HOME>/rules/*.md) load first, then project rules (<cwd>/.cyberine/rules/*.md),
both sorted by filename. Disable with CYBERINE_RULES=0; cap the size with CYBERINE_RULES_MAX_TOKENS
(default 4000). buildRulesPreamble is best-effort — no rules dir means no preamble, zero overhead.
Path-gated rules (frontmatter paths:): a rule file may carry YAML frontmatter with a paths:
field. The rule is injected ONLY when a glob in paths: matches the cwd path or its basename; rules
without paths: are always-on. Both a single scalar glob and a YAML list are accepted:
---
paths: "ai-*"
---
Always prefer Bun over npm for new scripts.---
paths:
- "**/WORK/AI/**"
- ai-agent-solution
---
Use the implementer fleet for every code task.Glob syntax: * matches within a path segment, ** crosses segments, ? matches one non-/ char.
Matching is best-effort — a buggy pattern is treated as always-on (never silences a rule).
Cyberine's own repo-specific rules (k03p4): .cyberine/rules/ai-agent-solution-invariants.md
in this repo (ai-agent-solution / Cyberine Loop itself) is a real project rules file, not an
example — it carries the rules that used to be injected into every dispatched worker in every
repo via HARD_INVARIANTS (makeOpenAIClient, no snapshot TUI tests, the core/adapters
dependency direction, npm run typecheck before push). Those name files and conventions that
only exist in ai-agent-solution's own tree, so a worker dispatched into an unrelated repo used to
receive confidently-wrong instructions about files it didn't have. Moving them into this repo's
own .cyberine/rules/*.md means buildRulesPreamble now injects them only for a dispatch whose
cwd is this repo — see "Hard-invariant injection into every worker prompt" below for what stayed
in HARD_INVARIANTS (product-generic, still global).
Long-term memory — episodic records, retrieval + injection (waves 1-4)
Every run that reaches a terminal state (done / error / cancelled) automatically writes an episodic memory record — no setup needed:
Ecosystem instruction files (AGENTS.md / CLAUDE.md)
Loop workers (raw-API, not CLI) automatically discover and read AGENTS.md / CLAUDE.md from the target repo and inject them as system-message context before the task. This gives every loop worker...