Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions internal/work/work.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ func (j Job) Instructions() string {
"Work the bead %s. Read it first, do what it asks, and close it when the work "+
"is done and not before. If you cannot complete it, leave it open and say why "+
"in a comment.%s\n\n"+
// Project orientation, said because its absence is expensive.
//
// The agent gets the bead and the checkout and nothing about the
// project itself -- no objective, no conventions -- so it
// rediscovers all of that by reading files, every run. datc-yft
// spent 872k input tokens across 177 steps on a task that was in
// part exploration it could have skipped. A repository usually
// states its own conventions; pointing the agent at them first is
// one line and turns a generic reimplementation into a change that
// fits the project a reviewer will accept.
"Before you change anything, get your bearings in this project. If it has "+
"guide files -- AGENTS.md, CLAUDE.md, README, CONTRIBUTING, or a docs/ "+
"directory -- read those first, then skim the code next to where you will "+
"work. They carry the conventions, the build, and the patterns this project "+
"already uses, so your change matches it rather than being a generic version a "+
"reviewer has to rework. This is cheap and saves the run that reimplements "+
"something the project already had a pattern for.\n\n"+
// The premature-stop guard. A run ends when a turn takes no action, so
// an agent that thinks out loud without editing or running anything
// stops mid-task -- ent4-tek exited after 3 minutes having only
Expand Down
15 changes: 15 additions & 0 deletions internal/work/work_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,18 @@ func TestAWorkJobNamesTheCheckout(t *testing.T) {
}
}
}

// A work job tells the agent to orient in the project before it edits.
//
// Without it the agent rediscovers the project's conventions by reading files
// every run: datc-yft spent 872k input tokens across 177 steps, part of it
// exploration it could have skipped. The prompt now points it at the repo's own
// guide files first.
func TestTheWorkPromptTellsTheAgentToGetOriented(t *testing.T) {
got := Job{Kind: KindWork, Cell: "oss", Bead: "wg-1"}.Instructions()
for _, want := range []string{"get your bearings", "AGENTS.md", "CONTRIBUTING"} {
if !strings.Contains(got, want) {
t.Errorf("the instructions do not point the agent at project context (%q):\n%s", want, got)
}
}
}
Loading