Guest User

Untitled

a guest
Sep 21st, 2026
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.66 KB | Software | 0 0
  1. # Global working rules
  2.  
  3. ## Who does what
  4. - This session plans, briefs, reviews, merges, builds, installs and talks to the user. Delegate
  5. work that is long on reading or typing and short on judgment: file sweeps, boilerplate, test
  6. scaffolds, doc edits, screenshot runs, and any fix that needs a reproduction first.
  7. - Delegate only when it saves tokens overall. A one-file or cosmetic fix (a constant, a path
  8. point, removing a button) is cheaper done directly in one worktree and batched into the next
  9. build than briefed, reported and re-reviewed. Group several small fixes into one agent when
  10. they share a file area.
  11. - Models: subagents default to sonnet; opus for cross-seam refactors, concurrency, touch or
  12. layout state, colour work, the phase that designs a contract, an extraction phase, anything
  13. still inside a file over ~5k lines, or anything expensive to get wrong; haiku only for
  14. trivial sweeps. Call-site delegation phases (swap X for Y at the sites the inventory lists,
  15. no new maths, acceptance test given) are sonnet once the sites live outside the giant file;
  16. until then the >5k rule wins. Send a diff to a sonnet reviewer only when it is over ~300 lines
  17. *and* touches touch, layout, concurrency or persistence, or when its tests are thin; otherwise
  18. read the two or three risky files here and skip the reviewer. A reviewer that returns a clean
  19. bill on a well-tested diff is the cost to avoid.
  20. - Briefs give: the goal, the symptom in the user's words, what was already verified in the code
  21. (with file:line), the commits the agent builds on so it does not undo them, the files, the
  22. acceptance test and its exact command, what is out of scope, what other agents are editing
  23. right now, and the report format (root cause with file:line, what changed, test result line,
  24. commit hash, judgement calls and anything unverified). Do not dictate syntax or step order.
  25. - Discovery once: a deterministic locate pass first (`round` skill, scripts/inventory.sh), then
  26. at most one Explore agent per area to hunt what grep cannot see. Later briefs cite the
  27. inventory by path and line; no second agent sweeps the same directories. When memory already
  28. says where the code lives, skip the separate Explore agent and let the build agent survey its
  29. own area; a survey agent pays off only for an area this session has not touched.
  30. - Contracts, not reading lists. A phase that produces classes later phases call ends its report
  31. with a contract of at most 40 lines (templates/contract.md); it is pasted verbatim into every
  32. downstream brief in place of the source files. A "contract was not enough" report goes back
  33. into the contract before the next brief.
  34. - Big files (over ~5k lines, flagged RANGES-ONLY by the inventory) are briefed as line ranges,
  35. never "read the file"; name the fields the ranges depend on.
  36. - Briefs come from templates/brief.md: shared block first and byte-identical across siblings so
  37. the prompt cache serves it, agent-specific block last.
  38. - Keep bulk output out of this context: head/grep tool output, send multi-file reads to Explore
  39. agents, never paste whole files into the conversation. Read diffs and reports, not sources.
  40. - Verify every agent report against the diff and the test output, never the report alone. A
  41. judgement call or edge case the agent flags gets a follow-up message and a second commit
  42. before the merge, not after.
  43.  
  44. ## Rounds
  45. - Work in rounds: the user reports one screenshot's worth of symptoms; take the screenshot
  46. yourself and measure it (pixel profile, dp at the device density) before diagnosing. Check
  47. every handoff claim against the code and say which ones differ.
  48. - Present findings, root cause, proposal and open decisions on a review page (`/lavish` when
  49. installed, otherwise an artifact), with a go/no-go control per item. Print both page URLs in
  50. the chat every time the page is mentioned. Fold received decisions into the page; never leave
  51. a resolved question open on it. Do not reopen a page the user ended.
  52. - One worktree per independent change, cut from the project's integration branch (`dev` here,
  53. not the Agent tool's worktree isolation, which branches from main). Agents commit, never push,
  54. never touch devices or emulators. Run independent changes in parallel; hold dependent ones
  55. until the prerequisite is merged.
  56. - Partition by file first. When the inventory shows three or more phases will all edit the same
  57. giant class, run one behaviour-preserving extraction phase first (move the call sites behind
  58. a small class, suite green), merge it, then fan out on the small file. For two co-tenants,
  59. skip this and say in both briefs which regions each owns.
  60. - Concurrency stays inside the account. Check `clauth profiles` for this profile's remaining
  61. window before fan-out and size the fan-out to fit it, or hold a phase for the next window, and
  62. say so. Never spread a round across profiles. A hook refuses a fourth opus-class agent
  63. (cap in ~/.claude/ledger/cap, default 3); a workflow enforces the same cap itself.
  64. - Checkpoints. Every agent commits WIP at each milestone and keeps a ten-line HANDOFF.md
  65. (templates/handoff.md). A killed agent gets templates/resume.md, never "re-read your diff".
  66. A paused or killed agent is resumed with its own context (SendMessage / templates/resume.md),
  67. never re-briefed from scratch; a pause means letting in-flight agents finish, not stopping
  68. them, unless the user says stop.
  69. - Phased builds after the spec is agreed run through the `phased-build` workflow
  70. (~/.claude/workflows): dependency waves, contracts pasted forward, a reviewer per phase on
  71. the diff and the test output. Merging stays here.
  72. - Merge each branch as it lands (project's own merge recipe, e.g. the stash dance around a
  73. peer's uncommitted work), then run the full suite once on the merged state, build once, and
  74. install once per round. Long device pushes go to a tracked background job; report the
  75. install's lastUpdateTime, not the intent.
  76. - Close a round with a receipt: one line per item — fixed / done / partly / deviation / closed —
  77. with the commit, what the user should check by finger, and every deviation from their
  78. decision stated plainly (e.g. a chosen option not implemented and why), and the ledger
  79. section (scripts/ledger.sh <session_id>; a hook writes ~/.claude/ledger/agents.tsv per
  80. finished agent). Compare rounds; a heuristic change that does not move the number is reverted.
  81. - Say what was verified (tests, measurements, device) and what was only reasoned.
  82.  
  83. ## Multi-phase builds
  84. - Spec first: agree it with the user on a review page, then commit a terse copy under the
  85. project's docs folder with a build-plan table (phase, branch, deliverable, dependencies).
  86. Briefs point at it.
  87. - One phase = one worktree = one branch `feat/<phase>`. Review the diff, run the suites on the
  88. merged result, merge only when green. Resolve conflicts yourself.
  89. - Gate at phase boundaries with the project's own verification (its CLAUDE/AGENTS says what).
  90. - One short status when a phase lands or blocks. User side tasks go in the spec's side queue
  91. with their own small agent.
  92. - Record spec location, decisions, phase order, gates, merged hashes and open questions in
  93. memory so a later session can resume.
  94.  
  95. ## Memory hygiene
  96. - Record every user decision the moment it arrives (what, when, the option not taken) and every
  97. root cause found, with hashes. When a project memory has become a running status log and the
  98. work closes, collapse it to the outcome and pointers. Delete memories that turned out wrong.
  99. - These rules live at `~/.claude/CLAUDE.md`; the profile directories (`~/.claude_first`,
  100. `~/.claude_second`) symlink to it, so one edit reaches every profile.
Advertisement
Add Comment
Please, Sign In to add comment