agentleFS
ryanmacleanryanmaclean/skills/bop-on/SKILL.md

bop-on

Skill1 starsChanged 49 days agoMITView on GitHub

O(N) design rule for bop loops. Use when adding cross-cutting behavior (logging, hooks, events, metrics) to dispatcher, merge-gate, or any per-card loop. Trigger words — performance, loop overhead, batch, per-card cost, O(2N).

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When adding behavior to a per-card loop (dispatcher, merge-gate, reap, status), never introduce per-item syscalls.

    line 8

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

bop O(N) — keep loops linear

When adding behavior to a per-card loop (dispatcher, merge-gate, reap, status), never introduce per-item syscalls. The loop body should do O(1) memory work per card; all I/O flushes once per iteration.

Approved patterns

1. Collect then flush

let mut events: Vec<Event> = Vec::new();

for card in cards {
    process(card);                   // existing work
    events.push(build_event(card));  // O(1) memory, no I/O
}

flush_events(&events);  // one write, one POST

2. Opt-in gate

let enabled = lineage::is_enabled();  // check once

for card in cards {
    process(card);
    if enabled {
        events.push(...);  // zero work when disabled
    }
}

3. Defer to background

let (tx, rx) = mpsc::channel();
std::thread::spawn(move || { for ev in rx { write(ev); } });

for card in cards {
    process(card);
    let _ = tx.send(build_event(card));  // non-blocking
}

Anti-patterns — reject these in review

Anti-patternWhy it's O(2N)Fix
File append per card in loopN extra fsync callsCollect → flush
Command::spawn per cardN fork+exec callsBatch or defer
Serialize JSON per card unconditionallyN allocs when no consumerOpt-in gate
HTTP POST per cardN network round-tripsBatch POST
Re-read config file per cardN file readsCache at loop top

Where this applies in bop

  • run_dispatcher() — processes up to max_workers cards per iteration
  • run_merge_gate() — processes all done/ cards per iteration
  • reap_orphans() — scans all running/ cards
  • print_state_group() — reads all cards in a state dir for bop status
  • cmd_doctor() acceptance criteria lint — iterates pending/ cards

COW note

fs::rename is metadata-only on APFS/ext4/btrfs — no bytes copied, COW reflinks preserved. It's already O(1). Don't wrap it in anything that adds O(N) I/O.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.