Skip to content

feat: add Sprout nest — persistent agent workspace at ~/.sprout#290

Merged
tlongwell-block merged 2 commits intomainfrom
feat/sprout-nest
Apr 10, 2026
Merged

feat: add Sprout nest — persistent agent workspace at ~/.sprout#290
tlongwell-block merged 2 commits intomainfrom
feat/sprout-nest

Conversation

@tlongwell-block
Copy link
Copy Markdown
Collaborator

Summary

On first launch, the Sprout desktop app now creates ~/.sprout/ — a shared knowledge directory where every agent starts with orientation and a place to accumulate research, plans, and logs across sessions.

~/.sprout/
├── AGENTS.md       ← 71-line agent orientation (Sprout comms, polling, knowledge conventions)
├── GUIDES/
├── RESEARCH/
├── PLANS/
├── WORK_LOGS/
├── REPOS/
├── OUTBOX/
└── .scratch/

Every agent spawned by the GUI gets ~/.sprout as its cwd. Goose reads AGENTS.md automatically.

Changes

File Lines What
nest.rs +217 ensure_nest_at() — idempotent directory creation, symlink-safe, 700 perms, 6 tests
nest_agents.md +71 Agent orientation: directory layout, Sprout MCP communication patterns, polling with since, context recovery, knowledge file conventions
mod.rs +28/−4 default_agent_workdir()~/.sprout with $HOME fallback, symlink rejection
lib.rs +12/−2 ensure_nest() called in setup() before agent restoration, non-fatal
check-file-sizes.mjs +1/−1 Bump lib.rs size limit

Safety

  • Idempotent — never overwrites existing files or directories
  • Symlink-safe — rejects symlinks at root (platform-independent) and skips chmod on symlinked children
  • 700 permissions on root and all real subdirectories
  • Non-fatal — agents fall back to $HOME if nest creation fails; app startup is never blocked
  • No secretsAGENTS.md is a static template via include_str!, no interpolation

Tests

6 unit tests covering creation, permissions, idempotency, symlink root rejection, and symlinked child permission skipping. All passing.

Review

Reviewer Score
Security (Lep) 9/10 ✅
Code quality (Clove) 9/10 ✅
Codex CLI 10/10 ✅
Architecture (Hana) Approved ✅

Create a shared knowledge directory (~/.sprout) on first launch so every
Sprout-spawned agent starts with orientation and a place to accumulate
research, plans, and logs across sessions.

Changes:
- nest.rs: ensure_nest_at() creates ~/.sprout with subdirs (GUIDES/,
  RESEARCH/, PLANS/, WORK_LOGS/, REPOS/, OUTBOX/, .scratch/), writes
  AGENTS.md on first init, sets 700 permissions on root and all real
  subdirectories. Rejects symlinks at root and skips chmod on symlinked
  children. Fully idempotent — never overwrites existing files.
- nest_agents.md: 71-line agent orientation doc covering directory layout,
  Sprout MCP communication (read/write/poll/search), context recovery,
  knowledge file conventions, and core guidelines. Tool names verified
  against sprout-mcp server source.
- mod.rs: default_agent_workdir() returns ~/.sprout (with $HOME fallback).
  Uses symlink_metadata() to reject symlinked nest roots.
- lib.rs: ensure_nest() called in setup() before agent restoration.
  Non-fatal — agents fall back to $HOME if nest creation fails.
- check-file-sizes.mjs: bump lib.rs size limit for nest init lines.

Tests: 6 passing (creation, permissions, idempotency, symlink rejection,
child-symlink permission skipping).

Review scores: Lep 9/10, Clove 9/10, Codex CLI 10/10.
Replace exists() + write() with OpenOptions::create_new(true) (O_CREAT|O_EXCL)
for atomic check-and-create. AlreadyExists is handled as the idempotent path.
This also guarantees we never clobber a user-edited file — no race window.
All existing tests pass unchanged.
@tlongwell-block tlongwell-block merged commit ff86e0c into main Apr 10, 2026
9 checks passed
@tlongwell-block tlongwell-block deleted the feat/sprout-nest branch April 10, 2026 19:01
tlongwell-block added a commit that referenced this pull request Apr 11, 2026
…ona-migration

* origin/main:
  feat(desktop): add Pulse social notes surface (#296)
  Fix flaky desktop smoke tests (#294)
  Add agent lifecycle controls to channel members sidebar (#291)
  Update nest_agents.md tagging info (#292)
  feat: add Sprout nest — persistent agent workspace at ~/.sprout (#290)
  Fix auth and SSRF vulns (#261)
  Add per-agent MCP toolset configuration to agent setup (#279)
  feat(desktop): team & persona import/edit flows (#288)
  Remove menu item subtitles and fix persona card overflow (#289)
  feat: Phase 1 video upload support (Blossom-compliant-ish) (#285)
  Add inline subtitles to menu items and field descriptions (#276)
  Improve ephemeral channel affordances and hide archived sidebar rows (#286)
  Fix @mention search to use word-boundary prefix matching (#278)
  Allow bot owners to remove their agents from any channel (#284)
  [codex] Polish agent selectors and settings layout (#283)

# Conflicts:
#	desktop/scripts/check-file-sizes.mjs
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.

1 participant