Skip to content

Preflight: rules and brain up to date before any work (0.5.0) - #12

Merged
moderniselife merged 1 commit into
mainfrom
feat/preflight
Nov 23, 2026
Merged

moderniselife merged 1 commit into
mainfrom
feat/preflight

Conversation

@moderniselife

Copy link
Copy Markdown
Owner

Why

Agents forget to pull, so they work from stale rules, and someone has to keep telling them to check.

What

  • .brainium.json takes two new fields:
    • update: checkouts to fast-forward
    • rules: files or folders the agent must follow. {agent} stands for the agent's slug, and a leading ! excludes a glob.
  • Pulls are fast-forward only. Brainium leaves these alone and reports them:
    • detached HEADs (pinned submodules)
    • branches with no upstream
    • pulls blocked by local work
  • It lists the rule files that changed since that agent's last preflight, tracked per agent and per repo. The first run lists all of them.
  • It runs in three places:
    • automatically in Claude Code's session-start hook
    • as the brain_preflight MCP tool, which the instructions and skills tell agents to call first
    • as brainium preflight for VMs, cron and CI
  • Each git call is capped at 8 seconds, so the 30-second hook never times out.

Tests

npm test: 57/57 pass. The new tests run against real bare repos and cover pulls, per-agent change tracking, {agent}, ! exclusions, detached HEADs, blocked pulls and the MCP tool.

🤖 Generated with Claude Code

Agents forget to pull, so they work from stale rules and someone has to
keep telling them to check. Preflight does it for them:

- .brainium.json takes "update" (checkouts to fast-forward) and "rules"
  (files or folders the agent must follow; "{agent}" is the agent's slug,
  "!" excludes a glob).
- Pulls are fast-forward only. Detached HEADs (pinned submodules),
  branches with no upstream, and pulls blocked by local work are left
  alone and reported.
- It lists the rule files that changed since that agent's last
  preflight (tracked per agent, per repo); the first run lists them all.
- Runs automatically in Claude Code's session-start hook, as the
  brain_preflight MCP tool (instructions and skills say to call it
  first), and as `brainium preflight` for VMs, cron and CI. Each git
  call is capped at 8s so the 30s hook never times out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@moderniselife
moderniselife merged commit 41aa45f into main Nov 23, 2026
5 checks passed
@moderniselife
moderniselife deleted the feat/preflight branch November 23, 2026 21:31
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