Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(next): avoid files held by in-flight work [N2,B4,N20]
Corey Olson80a135a09621
diff --git a/src/board.js b/src/board.jsindex 0887bd87..ead0705f 100644--- a/src/board.js+++ b/src/board.js@@ -48,6 +48,8 @@ import {briefFiles,briefSections,} from './brief.js';+import { itemFiles, itemFileCollisions } from './item-files.js';+export { itemFiles };import { COORDINATOR } from './config.js';import {manualLandingFailure,@@ -2335,6 +2337,7 @@ export function nextFor(board, { agentId, lane, verify = false, policy = 'any',if (hold) { selectedLanes.delete(name); reasons.push(`${hold.hold_by} holds the ${name} lane: ${hold.hold_reason}`); }}const compare = buildOrder(board, { warm });+ const inFlight = listItems(board, { all: true });const recent = new Set(warm);const mainRed = new Set(priority);const laneItems = items.filter((entry) => entry.item_status === 'open' && selectedLanes.has(entry.item_lane));@@ -2366,6 +2369,8 @@ export function nextFor(board, { agentId, lane, verify = false, policy = 'any',.filter((before) => before.item_status !== 'verified');const reserved = firstRefusalReason(board, entry.item_id, agentId);if (reserved) { reasons.push(reserved); continue; }+ const collisions = itemFileCollisions(entry, inFlight);+ if (collisions.length) { reasons.push(...collisions); continue; }if (!waiting.length) return { item: entry, reasons, shared };reasons.push(`#${entry.item_id} waits on ${waiting.map(waitingOn).join(', ')}`);}@@ -2406,18 +2411,6 @@ function idleReason(items, lane, routed) {return `${reason}; ${awaiting.join(', ')} still await${awaiting.length === 1 ? 's' : ''} a verdict, and a rejected item comes back to this lane. A lane is done when its items are verified`;}-/**- * The files an item touches, as far as the board knows: the files its submission changed, else the- * files its brief names.- *- * @param {any} item- * @returns {string[]}- */-export function itemFiles(item) {- const changed = (item.item_files ?? '').split('\n').filter(Boolean);- return [...new Set([...changed, ...briefFiles(item.item_brief ?? '')])];-}-/*** Finished items that touched the same files as this one, most shared first (N21). A builder* starting cold reads how its neighbours were done instead of rediscovering it. File overlap, notdiff --git a/src/commands/claim.js b/src/commands/claim.jsindex 68843101..6992466e 100644--- a/src/commands/claim.js+++ b/src/commands/claim.js@@ -2,6 +2,8 @@import {headCommit,} from '../git.js';+import { getItem, listItems } from '../board.js';+import { itemFileCollisions } from '../item-files.js';import {MainSpecMerged,actOn,@@ -27,7 +29,9 @@ export async function run(io, { first }) {me = whoAmI(ctx, board);}}- io.result?.({ id: idArg(first), ...result });+ const warnings = itemFileCollisions(getItem(board, id), listItems(board, { all: true }));+ io.result?.({ id, ...result, ...(warnings.length ? { warnings } : {}) });+ for (const warning of warnings) io.say(`warning: ${warning}; explicit claim retained`);io.say(`${result.renewed ? 'renewed' : 'claimed'} #${first} until ${result.leaseUntil}; criterion frozen as ${result.digest.slice(0, 12)}`);return 0;});diff --git a/src/item-files.js b/src/item-files.jsnew file mode 100644index 00000000..8995c331--- /dev/null+++ b/src/item-files.js@@ -0,0 +1,24 @@+import { briefFiles } from './brief.js';++/**+ * The files an item touches, as far as the board knows: the files its submission changed, else the+ * files its brief names.+ *+ * @param {any} item+ * @returns {string[]}+ */+export function itemFiles(item) {+ const changed = (item.item_files ?? '').split('\n').filter(Boolean);+ return [...new Set([...changed, ...briefFiles(item.item_brief ?? '')])];+}++/** Name overlaps with current in-flight items; callers supply lease-normalized board records. */+export function itemFileCollisions(item, items) {+ const files = new Set(briefFiles(item.item_brief ?? ''));+ if (!files.size) return [];+ return items.filter(other => other.item_id !== item.item_id && (other.item_status === 'claimed'+ || other.item_status === 'submitted' || (other.item_status === 'verified' && !other.item_merged_commit)))+ .map(other => ({ item: other, shared: itemFiles(other).filter(path => files.has(path)) }))+ .filter(other => other.shared.length)+ .map(other => `#${item.item_id} waits for #${other.item.item_id} (${other.item.item_status}) on ${other.shared.join(', ')}`);+}