From 5209d39cbc6b020a1572ff3137e39b7d175174f0 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 20 Jul 2026 17:28:59 +0300 Subject: [PATCH] docs(global-rules): make canonical worktree path / Rule 8 (and the mirrored global-prompt and Antigravity-overlay entries) documented only the worktree ROOT $HOME/.hasna/repos/worktrees, so agents placed worktrees flat or under a segment. Spell out the canonical two-segment path $HOME/.hasna/repos/worktrees//, forbid the station-id and flat variants, and point to 'repos scan'. Matches knowledge convention k_mrj32xhu_efxkxl (reaffirmed 2026-07-20 after a station01 drift audit: 40 flat + ~201 station-prefixed of 362 worktrees). The @hasna/repos enforcement gap is tracked as open-repos task 10a0f26e. --- src/global-agent-rules.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/global-agent-rules.ts b/src/global-agent-rules.ts index ace7770..9277ceb 100644 --- a/src/global-agent-rules.ts +++ b/src/global-agent-rules.ts @@ -147,7 +147,7 @@ export const globalAgentInstructionSourceInputs: InstructionSourceInput[] = [ "", "Automatically rename the session when the agent runtime supports it, using a concise task- or repo-specific name that improves later coordination.", "", - "Repo mutation must happen in a task-specific worktree under the canonical worktree root $HOME/.hasna/repos/worktrees. Prefer Hasna repo/project worktree mechanisms when available; otherwise use git worktree rooted there. Never mutate shared checkouts. Normal changes are PR-first: use a branch/worktree and open or prepare a PR for landing.", + "Repo mutation must happen in a task-specific worktree at the canonical worktree path $HOME/.hasna/repos/worktrees// (repo name then worktree name; do not insert a station-id or machine segment and do not place worktrees flat under the worktrees root). Prefer Hasna repo/project worktree mechanisms when available; otherwise use git worktree at that path and run `repos scan` afterwards. Never mutate shared checkouts. Normal changes are PR-first: use a branch/worktree and open or prepare a PR for landing.", "", "Never push directly to main, default, or protected branches unless the user explicitly instructs that exact repository and exact operation. Preserve unrelated code and avoid broad cleanup that is not required for the task.", "", @@ -189,7 +189,7 @@ export const globalAgentInstructionSourceInputs: InstructionSourceInput[] = [ "2. Hasna CLIs/packages are the source of truth for their domains: todos, conversations, mementos, knowledge, projects, repos, accounts, instructions, machines, secrets, and access.", "3. Planning and evidence belong in Todos CLI tasks and todos plans. Keep task status, comments, commits, verification commands, and handoff evidence current.", "4. Use automatic session renaming when the agent supports it, with a concise task- or repo-specific name.", - "5. Repo mutation must happen in a task-specific worktree under the canonical worktree root $HOME/.hasna/repos/worktrees. Prefer Hasna repo/project worktree mechanisms when available; otherwise use git worktree rooted there. Never mutate shared checkouts.", + "5. Repo mutation must happen in a task-specific worktree at the canonical worktree path $HOME/.hasna/repos/worktrees// (repo name then worktree name; do not insert a station-id or machine segment and do not place worktrees flat under the worktrees root). Prefer Hasna repo/project worktree mechanisms when available; otherwise use git worktree at that path and run `repos scan` afterwards. Never mutate shared checkouts.", "6. PR-first landing is the default: normal changes go through a branch/worktree plus a pull request or prepared pull-request handoff.", "7. Never push directly to main, default, or protected branches unless the user explicitly instructs that exact repo and exact operation.", `8. ${noBrittleHardcodingRule}`, @@ -262,7 +262,7 @@ export const globalAgentInstructionSourceInputs: InstructionSourceInput[] = [ "7. Act autonomously: diagnose and repair owning CLIs, packages, and workflows before asking the user; ask only for destructive, secret-bearing, or user-only decisions.", "", "CODE AND LANDING RULES", - "8. Repo mutation must happen in a task-specific worktree under the canonical worktree root $HOME/.hasna/repos/worktrees. Prefer Hasna repo/project worktree mechanisms when available; otherwise use git worktree rooted there. Never mutate shared checkouts.", + "8. Repo mutation must happen in a task-specific worktree at the canonical worktree path $HOME/.hasna/repos/worktrees// (repo name then worktree name; do not insert a station-id or machine segment and do not place worktrees flat under the worktrees root). Prefer Hasna repo/project worktree mechanisms when available; otherwise use git worktree at that path and run `repos scan` afterwards. Never mutate shared checkouts.", "9. PR-first landing is the default: normal changes go through a branch/worktree plus a pull request or prepared pull-request handoff.", "10. Never push directly to main, default, or protected branches unless the user explicitly instructs that exact repo and exact operation.", `11. ${noBrittleHardcodingRule}`, @@ -326,7 +326,7 @@ export const globalAgentInstructionSourceInputs: InstructionSourceInput[] = [ "", "Render this source into Antigravity managed instruction blocks using the renderer-owned Antigravity path convention. Preserve repository and user instructions outside the managed block.", "", - "Use Todos CLI tasks and plans as the source of truth for Antigravity work. Keep mutation in task-specific worktrees under $HOME/.hasna/repos/worktrees and use PR-first landing for normal changes.", + "Use Todos CLI tasks and plans as the source of truth for Antigravity work. Keep mutation in task-specific worktrees at $HOME/.hasna/repos/worktrees// and use PR-first landing for normal changes.", "", "Antigravity is an active global instruction provider target. Do not create or restore Gemini as an active provider target in this source set.", ]),