feat(desktop): dynamic nest AGENTS.md regeneration#583
Closed
wpfleger96 wants to merge 5 commits into
Closed
Conversation
c8fb76c to
6220ec5
Compare
AGENTS.md in ~/.sprout is now dynamically regenerated whenever personas, agents, or workspace config changes. Agents discover their teammates on every fresh session via a managed section demarcated by HTML comment markers. User edits outside the markers are preserved across regenerations.
BackendKind and RespondTo are only used in test helper constructors.
Fixes identified by crossfire review (Codex + Gemini) and plan author: - Use tempfile::NamedTempFile for atomic writes instead of deterministic .tmp path that races under concurrent regeneration triggers - Enforce ordered BEGIN/END marker search with line-start anchoring to prevent inverted slicing when markers are out of order or mid-line - Strip orphan BEGIN markers before appending new managed section - Escape pipe and newline characters in agent/persona names to prevent Markdown table corruption - Rename "Role" column to "Persona" (display_name is a name, not a role) - Move regenerate_nest_context calls outside lock scope in all mutation hooks to reduce lock hold time and eliminate future deadlock risk - Add 7 adversarial unit tests: marker ordering, orphan cleanup, duplicates, code-block false positives, pipe/newline escaping, idempotency
nest.rs grew to 770 lines with regenerate_nest_context, marker helpers, and 19 unit tests. The 500-line default is too tight for this file — override to 800 following the established pattern.
6220ec5 to
74a2c1a
Compare
wpfleger96
added a commit
that referenced
this pull request
May 15, 2026
…uplication base_prompt.md (injected every turn via [Base]) already has a comprehensive CLI reference table covering all 11 command groups. The CLI_QUICK_REFERENCE constant in nest.rs was a less complete duplicate (4 commands). AGENTS.md's dynamic section now focuses on what's unique to it: active agents and workspace info. Also bumps personas.rs file size override from 900 to 950 to accommodate the merge_personas inequality checks added in the review-fix commit.
Collaborator
Author
|
Consolidated into #584 — both PRs modify agent context (base prompt + AGENTS.md dynamic section) and are better reviewed/tested together. All commits preserved. Also removed the |
wpfleger96
added a commit
that referenced
this pull request
May 18, 2026
…uplication base_prompt.md (injected every turn via [Base]) already has a comprehensive CLI reference table covering all 11 command groups. The CLI_QUICK_REFERENCE constant in nest.rs was a less complete duplicate (4 commands). AGENTS.md's dynamic section now focuses on what's unique to it: active agents and workspace info. Also bumps personas.rs file size override from 900 to 950 to accommodate the merge_personas inequality checks added in the review-fix commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<!-- BEGIN SPROUT MANAGED -->/<!-- END SPROUT MANAGED -->demarcated section to~/.sprout/AGENTS.mdthat the desktop app regenerates whenever relevant state changesregenerate_nest_context()function innest.rsrenders active agents, workspace config, and CLI reference into the managed section while preserving user edits outside the markerstempfile::NamedTempFile+persist()prevent partial writes on crash or concurrent triggersContext
Agents operating in
~/.sprout/had no reliable way to discover who else is in the workspace. The staticAGENTS.mdtemplate told agents about directory layout and MCP tools but said nothing about the workspace's current inhabitants. This makes cross-agent coordination brittle — agents can't@mentionteammates they don't know exist.The dynamic section is eventually consistent: agents read
AGENTS.mdatsession/newtime, so updates become visible on the next session rotation.Merge order: This PR should merge after #585 (CLI grouped command format) — the CLI Quick Reference section uses the grouped syntax.