Files
loki/scripts/test/agent-notes.ts
CatoandClaude c5a52da875 fix(enrich): read AGENTS.md; a CLAUDE.md pointer adds nothing (#1468)
Every fleet repo's CLAUDE.md is now a one-line pointer to AGENTS.md, so
profile enrichment (the route and the backfill script) was sending the model
a pointer instead of the repo's notes. Both now read AGENTS.md, and keep
CLAUDE.md only where it still holds real notes (repos outside the fleet).


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-29 18:05:22 +01:00

30 lines
1.1 KiB
TypeScript

// Profile enrichment reads AGENTS.md; a CLAUDE.md that only points there adds
// nothing, but a repo outside the fleet may still keep real notes in it.
// Run: npx tsx scripts/test/agent-notes.ts
import { agentNotes } from "@/lib/agent-notes";
let pass = 0,
fail = 0;
function ok(name: string, cond: boolean) {
if (cond) {
pass++;
console.log(` ✓ ${name}`);
} else {
fail++;
console.log(` ✗ ${name}`);
}
}
const pointer =
"Read [AGENTS.md](AGENTS.md). It points at `bitbaum/fleet` `AGENTS.md`, which\nevery agent reads; nothing here restates either.\n";
ok("the fleet pointer is dropped", agentNotes(pointer) === null);
ok("an @AGENTS.md import is dropped", agentNotes("@AGENTS.md\n") === null);
ok("a missing file stays missing", agentNotes(null) === null);
const notes = "# Acme\n\nA booking site for a bakery. Next.js, Postgres, deployed on the box.\n";
ok("real notes are kept", agentNotes(notes) === notes);
const long = pointer + "\n## Local notes\n" + "x".repeat(500);
ok("a pointer followed by real notes is kept", agentNotes(long) === long);
console.log(`\n${pass} passed, ${fail} failed`);
if (fail) process.exit(1);