Skip to content

feat: add Project entity with auto-injected agent context#382

Open
wesbillman wants to merge 3 commits intomainfrom
feature/projects
Open

feat: add Project entity with auto-injected agent context#382
wesbillman wants to merge 3 commits intomainfrom
feature/projects

Conversation

@wesbillman
Copy link
Copy Markdown
Collaborator

Summary

  • Introduces a first-class Project entity that groups channels and provides shared context to agents, eliminating the need to copy-paste canvas instructions into every new channel
  • Projects are relay-stored Nostr events (kinds 50001-50003) with full CRUD: DB table, relay ingest/side-effects, REST API, SDK builders, and 5 MCP tools
  • Channels gain an optional project_id FK — when set, the ACP harness automatically injects the project's prompt, repos, and environment into the [Context] block agents receive
  • Includes 21 tests (SDK builders, ingest classification, DB CRUD), environment validation, empty-update guards
  • Updates VISION.md and TESTING.md

What agents see automatically:

[Context]
Scope: channel
Channel: support-projects (#uuid)

[Project: sprout-dev]
Description: Sprout relay and desktop development
Environment: local
Repos: git@github.com:block/sprout.git

We're working on ~/dev/sprout here. Make sure we create new
worktrees for new work. Worktrees live in ~/.sprout/worktrees.

Files changed (24 files, +1105/-76)

  • New: sprout-core/src/project.rs, sprout-db/src/project.rs, sprout-relay/src/api/projects.rs
  • Core: kind.rs (3 new event kinds), schema.sql (projects table + FK)
  • Relay: ingest.rs, side_effects.rs, router.rs, api/mod.rs
  • SDK/MCP: builders.rs (3 builders + channel update), server.rs (5 tools), toolsets.rs
  • ACP: pool.rs (project cache + fetch), queue.rs (format_prompt injection), relay.rs (ProjectInfo), main.rs
  • Docs: VISION.md, TESTING.md

Future work

  • Desktop UI (project management, project picker on channel creation)
  • Project-level access control
  • Cache TTL / invalidation

Test plan

  • cargo check --workspace passes
  • cargo test -p sprout-sdk -- project — 9 builder tests pass
  • cargo test -p sprout-relay -- project — 6 ingest classification tests pass
  • cargo test -p sprout-db -- project — 6 DB CRUD tests (require Postgres)
  • cargo clippy --workspace -- -D warnings passes
  • All pre-commit and pre-push hooks pass
  • Manual: create project via MCP, create channel with project_id, verify agent receives project context

🤖 Generated with Claude Code

wesbillman and others added 2 commits April 21, 2026 15:30
Introduces a first-class Project entity that groups channels and
provides shared context to agents — eliminating the need to
copy-paste canvas instructions into every new channel.

Projects are relay-stored Nostr events (kinds 50001-50003) with a
full CRUD pipeline: DB table, relay ingest/side-effects, REST API,
SDK builders, and 5 MCP tools (create, get, list, update, delete).

Channels gain an optional project_id FK. When a channel belongs to
a project, the ACP harness automatically injects the project's
prompt, repos, and environment into the [Context] block that agents
receive — no manual setup required.

Includes 21 tests (SDK builders, ingest classification, DB CRUD),
environment validation, empty-update guards, and updates to
VISION.md and TESTING.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collapse nested if blocks into match guard patterns in messages.rs
and ingest.rs to satisfy clippy::collapsible_match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wesbillman
Copy link
Copy Markdown
Collaborator Author

Design Status & Future Roadmap

Summary of concerns discussed during design and where each stands:

Concern Status Details
Stop copy-pasting canvas context ✅ Solved Project prompt field auto-injected into agent [Context] block via ACP harness
Multiple repos per project ✅ Solved repo_urls JSONB array on projects table
Mobile → create channel with project ✅ Solved Project lives in relay, mobile can list/select, agents fetch from relay
Different local paths per user 🏗️ Architecture ready Relay stores repo identity (git remote URL), local config resolves to disk paths. Need to build ~/.sprout/config.toml reader in ACP harness
Local agents vs blox agents in same channel ✅ Architecture right environment field currently on project as a hint. Should evolve to per-agent-runtime config — same channel can have local + blox agents simultaneously
Worktree support 🏗️ Design ready Add use_worktrees: bool to project schema, worktree root belongs in local config (~/.sprout/config.toml)
Agent routing (who picks up work) 📋 Future Not project-specific — broader orchestration concern for when laptop is asleep but blox should handle work

Architecture: Relay = WHAT, Edge = WHERE

The project entity stores what agents work on (repo identities, shared instructions, preferences). Each agent runtime determines where and how (local paths, worktree roots, compute environment). This split means:

  • Your laptop ACP reads the project from relay, merges with your local config (~/dev/sprout), agents see resolved paths
  • Teammate's laptop ACP reads same project, merges with their local config (~/code/sprout), their agents see their paths
  • Blox ACP reads same project, clones from git remote, agents work in blox workspace
  • Mobile reads project metadata from relay for display/selection — never needs local paths

What's next (incremental, no rearchitecting needed)

  1. ~/.sprout/config.toml — local config reader in ACP harness for repo path mapping
  2. use_worktrees flag on project schema
  3. Refine environment from project-level hint to agent-runtime config
  4. Desktop UI — project management + project picker on channel creation
  5. Project-level access control scoping

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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