library: Library → Instructions gives Devin its global AGENTS.md (#3151, eqe365 on Discord)

eqe365 on Discord (#3151): Devin CLI reads AGENTS.md, but Library →
Instructions listed Devin as keeping no user-wide instructions file.
Devin's target had Skills and MCP and no Instructions.

Source: the docs Devin CLI 3000.11.92 ships with it,
share/devin/docs/extensibility/rules.mdx ("Rules & AGENTS.md" → Global
Rules). It reads global rules from ~/.config/devin/AGENTS.md
(%APPDATA%\devin\AGENTS.md on Windows) at the start of every session, and
the singular AGENT.md there too. Devin's folder (a.Dir) is already that
folder, so Instructions is AGENTS.md there, or AGENT.md when only that
one exists (firstThere). The GUI is data-driven and needs no change.

Test: TestDevinInstructions (internal/library/agent_skills_test.go)
checks:
- the target is AGENTS.md before the file exists;
- Save writes the shared block after the user's own text;
- with only AGENT.md present, that file is the target.
With targets.go reverted it fails: "Devin's instructions: "", want
.../.config/devin/AGENTS.md before the file is there".

Run with this change on origin/main ba319a758 (before the rebase),
set -o pipefail, GOMODCACHE pinned:
- gofmt -l: clean.
- go vet ./..., GOOS=linux go vet -tags nogui ./... and GOOS=windows
  go vet ./...: all clean. darwin, linux nogui and windows builds: ok.
- go test -timeout 45m ./...: 66 packages ok. Two timed out at 45m
  while the machine's load average was 24 to 60 (other sessions'
  suites):
  - internal/library (2724s; TestCheckSkills had been running 6s at the
    deadline). Alone at -timeout 90m it is ok in 2204s. This is #2853.
  - internal/agent (2714s). It doesn't import internal/library, so it
    runs the same code as origin/main. This is #2544.
- Packages that import library are ok: backup, cli, davsync, gui,
  profile, tui.
- No GUI files touched.

Not tried: a real Devin session reading the file; the claim rests on
Devin's own shipped docs.
This commit is contained in:
yetone
2026-10-21 18:05:03 +08:00
parent b855cfee9e
commit e656888867
2 changed files with 38 additions and 0 deletions
+33
View File
@@ -190,6 +190,39 @@ func TestDroidGrokInstructions(t *testing.T) {
}
}
// Devin CLI reads its global rules from AGENTS.md in its config folder
// (~/.config/devin, %APPDATA%\devin on Windows), else the singular AGENT.md
// there (#3151): the library's instructions reach it, after what the user
// wrote, which stays, and Devin is offered them rather than listed as having
// no user-wide file.
func TestDevinInstructions(t *testing.T) {
h := sandbox(t)
write(t, filepath.Join(h, ".config/devin/config.json"), "{}")
tg := targetByID("devin")
if tg == nil {
t.Fatal("Devin isn't a target")
}
f := filepath.Join(tg.Agent.Dir, "AGENTS.md")
if tg.Instructions != f {
t.Fatalf("Devin's instructions: %q, want %q before the file is there", tg.Instructions, f)
}
write(t, f, "# Mine\n")
shared := "Use tabs."
ok(t)(SaveInstructions(InstructionsChange{Shared: &shared, Agents: []string{"devin"}}))
if s := read(t, f); s != "# Mine\n\n"+blockBegin+"\nUse tabs.\n"+blockEnd+"\n" {
t.Fatalf("Devin's AGENTS.md:\n%s", s)
}
// a user who keeps theirs as AGENT.md has it written there instead
h = sandbox(t)
write(t, filepath.Join(h, ".config/devin/config.json"), "{}")
dir := targetByID("devin").Agent.Dir
write(t, filepath.Join(dir, "AGENT.md"), "# Mine\n")
if tg := targetByID("devin"); tg.Instructions != filepath.Join(dir, "AGENT.md") {
t.Fatalf("Devin with AGENT.md: %q", tg.Instructions)
}
}
// Qwen Code reads QWEN.md in its folder ($QWEN_HOME, else ~/.qwen) before
// every conversation (wongxy on Discord): the library's instructions reach
// it there, after what the user wrote, which stays; its settings'
+5
View File
@@ -304,6 +304,11 @@ func targetOf(a *agent.Agent) *Target {
// beside its config.json (devin mcp add --scope user)
t.MCP = &mcpFile{Path: filepath.Join(a.Dir, "mcp_config.json"), Format: fmtDevin}
t.Skills = filepath.Join(a.Dir, "skills")
// and its global rules from AGENTS.md there, else the singular
// AGENT.md it also reads, at the start of every session (Rules &
// AGENTS.md → Global Rules in the docs Devin CLI 3000.11.92 ships,
// share/devin/docs/extensibility/rules.mdx, #3151)
t.Instructions = firstThere(a.Dir, "AGENTS.md", "AGENT.md")
case "grok":
// Grok Build reads [mcp_servers.<name>] from its config.toml, as
// `grok mcp add` writes them; its user-wide instructions are