Skip to content

feat(sprout-agent): load AGENTS.md and SKILL.md into system prompt#762

Merged
wpfleger96 merged 3 commits into
mainfrom
worktree-wpfleger+sprout-agent-hints
May 29, 2026
Merged

feat(sprout-agent): load AGENTS.md and SKILL.md into system prompt#762
wpfleger96 merged 3 commits into
mainfrom
worktree-wpfleger+sprout-agent-hints

Conversation

@wpfleger96
Copy link
Copy Markdown
Collaborator

@wpfleger96 wpfleger96 commented May 27, 2026

Add AGENTS.md and SKILL.md support to sprout-agent, giving it the same project-hint and skill context that goose and Claude Code already inject for their agents.

This belongs in sprout-agent rather than sprout-acp because other harnesses (goose, Claude Code) already handle their own loading — injecting it in sprout-acp would double the context. At session/new time sprout-agent walks from ~/AGENTS.md (global) through the git root to CWD collecting AGENTS.md files, scans .agents/skills/, .goose/skills/, and .claude/skills/ for SKILL.md entries with YAML frontmatter, then appends global skills from ~/.agents/skills/. The combined content is prepended to the configured system prompt for that session, computed once at session creation and immutable per-session. SPROUT_AGENT_NO_HINTS=1 disables loading entirely.

  • New hints.rs module: find_git_root, load_hint_files, discover_skills, parse_skill_frontmatter, build_hints_section — all pure sync I/O, tolerates missing files silently
  • Global hierarchy: ~/AGENTS.md loaded first (before git-root chain); ~/.agents/skills/ scanned after CWD-relative dirs (project wins on name conflict via first-name-wins dedup)
  • Session gains effective_system_prompt: Arc<str>; Llm::complete now takes an explicit system_prompt: &str (mirrors the existing summarize signature)
  • Caps: 128 KB total hints, 32 KB per skill body; UTF-8 safe truncation at character boundaries
  • 20 unit tests + 6 integration tests (subprocess + capturing HTTP LLM backend), including E2E coverage of global hint/skill loading

@wpfleger96 wpfleger96 requested a review from a team as a code owner May 27, 2026 20:13
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+sprout-agent-hints branch 2 times, most recently from 8019b36 to 8cc7423 Compare May 28, 2026 20:00
@wpfleger96
Copy link
Copy Markdown
Collaborator Author

Old behavior: agents aren't properly aware of any skills or AGENTS.md content
image

New behavior: agents are aware of all skills and AGENTS.md content, "local"/project level AND "global"/user level
image

image

@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+sprout-agent-hints branch from 8cc7423 to 934b530 Compare May 29, 2026 00:04
sprout-agent had zero support for AGENTS.md or SKILL.md — the only
context it got was a hardcoded 1-line system prompt plus whatever
sprout-acp assembled. Other harnesses (goose, Claude Code) handle
their own loading, so this belongs in sprout-agent, not sprout-acp.

At session/new time, walks from git-root to CWD collecting AGENTS.md
files, scans .agents/skills/, .goose/skills/, .claude/skills/ for
SKILL.md entries with YAML frontmatter, and prepends the combined
content to the system prompt. SPROUT_AGENT_NO_HINTS=1 disables.
Reuse mcp::truncate_at_boundary instead of duplicating it in hints.rs,
store effective_system_prompt as Arc<str> to avoid a 128KB clone per
session/prompt, and strip WHAT doc comments per project style.
…archy

sprout-agent only loaded hints from the git-root→CWD chain, missing
user-level instructions entirely. Adds home directory as the first
layer: ~/AGENTS.md is prepended before project hints, and
~/.agents/skills/ is scanned after CWD-relative dirs (project wins
on name conflict). Includes dedup guard when ~ is already in the chain.
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+sprout-agent-hints branch from 934b530 to ce15067 Compare May 29, 2026 00:41
@wpfleger96 wpfleger96 merged commit f34a21d into main May 29, 2026
14 checks passed
@wpfleger96 wpfleger96 deleted the worktree-wpfleger+sprout-agent-hints branch May 29, 2026 18:44
tlongwell-block pushed a commit that referenced this pull request May 29, 2026
)

Signed-off-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants