Skip to content

docs: agent-compose.yaml design spec (TASK-098)#228

Merged
jsell-rh merged 3 commits intomainfrom
feat/agent-compose-spec-task098
Mar 17, 2026
Merged

docs: agent-compose.yaml design spec (TASK-098)#228
jsell-rh merged 3 commits intomainfrom
feat/agent-compose-spec-task098

Conversation

@jsell-rh
Copy link
Owner

Summary

Design spec for agent-compose.yaml — a portable team blueprint file for exporting and importing agent hierarchies between spaces/environments.

Key design decisions:

  • Team blueprint, not session snapshot: includes agent configs + personas, excludes tasks/runtime state/tokens
  • Sync import model (kubectl apply style): create new agents, update existing configs, leave unmentioned agents alone (opt-in --prune)
  • Inline personas: prompt text travels with the file — this is the team's domain expertise
  • Drift detection: track fleet_config_hash per agent; show "out of sync" badge + "Sync fleet" button when config diverges from last import
  • 3-phase implementation: export+import → drift detection → polish

Design discussion summary

  • Boss confirmed: no tasks in export (ephemeral scratchpad, not team structure)
  • Import semantics: sync model with dry-run preview before commit
  • Drift detection + "Restart to sync" / "Sync fleet" UI included per boss request

Test plan

  • Design review by boss/cto before implementation begins
  • Implementation tracked as TASK-098 phases

Closes TASK-098 (design phase)

🤖 Generated with Claude Code


---

## Drift Detection

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a Why section here - asking because I don't understand why its required.

The application is getting heavy on features, we should be able to spell out real use cases where I would want automatic drift detection and resolution in the application.

If we abandon drift detection / resolution, it simplifies this feature quite a bit, as we don't need to store any state in the application.

@jsell-rh
Copy link
Owner Author

Updated the spec based on @tiwillia's feedback and additional direction: server-side drift tracking is removed entirely. The revised model is terraform-style: the YAML file is the source of truth, and boss import --dry-run detects 'drift' by fetching current server state and computing the diff client-side. Server only exposes resource primitives (agent/persona CRUD). No fleet state stored on the server. Commit 8963ca5.


## CLI Architecture — Import as a Client-Side Tool

`boss import` is implemented entirely in the CLI. It does not call a single monolithic server endpoint. Instead, it:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine some use cases that will require this to be supported in the server as well (like adding this capability to the MCP server) but +1 to move forward, this is simple and easy to expand upon in its current state.

@jsell-rh jsell-rh enabled auto-merge (squash) March 17, 2026 20:05
jsell-rh and others added 3 commits March 17, 2026 16:13
Portable team blueprint format for exporting/importing agent hierarchies.
Covers: YAML schema, sync import semantics, drift detection, CLI + UI surface,
and 3-phase implementation plan.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…edback

Key changes:
- Import repositioned as CLI tool calling existing endpoints (not a
  monolithic POST /spaces/import). Server exposes primitives; CLI
  orchestrates the import plan (terraform model).
- Remove server-side drift tracking (fleet_config_hash, drift endpoints).
  Diff is computed client-side by comparing local YAML to fetched server
  state — same as kubectl apply / terraform apply.
- Import UI modal uses same client-side diff approach.
- Add --restart-changed flag (replaces --restart-drifted) for immediately
  respawning agents whose config changed after import.
- Address reviewer comment (tiwillia): remove server-side state tracking,
  keep import/export simple with no new server concepts.
- Security section retained: command allowlist, YAML bomb protection,
  prompt injection notes, prune+live-session safety, auth.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
P0:
- Remove false "persona sandboxing" claim; replace with accurate
  statement that prompts are stored as-is, operators must review
  before importing from untrusted sources
- Dry-run now shows full persona prompt diffs (not just one-line
  summary); malicious prompts are visible before apply

P1:
- shared_contracts: explicit delivery mechanism documented
  (prepended to ignition text before personas + initial_prompt)
- Composition order rule: shared_contracts → persona(s) → initial_prompt
- Persona ID namespace: global namespace documented as known tradeoff;
  guidance to use unique IDs (e.g. project-prefixed)
- Server-side YAML bomb guard: enforced independently of CLI, covers
  UI upload path (1MB / 100 agents)
- repos URL validation: HTTPS-only, RFC 1918 + link-local blocked,
  DNS pre-check before passing to ambient runner
- work_dir validation: absolute path required, .. rejected after Clean,
  BOSS_WORK_DIR_PREFIX configurable allowed prefix
- Post-import state: "N agents created, none running yet" + Spawn all
  action (CLI: --spawn-after-import; UI: button in success modal)
- Phase ordering fixed: export + import core ship together (Phase 1);
  --prune and --restart-changed move to Phase 2

P2:
- UI diff XSS: all YAML-sourced content rendered as plain text, no
  innerHTML of user-controlled strings
- Export URL credential scrubbing: userinfo stripped from repo_url
- agent description field added to schema table
- Round-trip fidelity: export always includes all fields explicitly
  (even defaults) to prevent phantom diffs on re-import
- Space creation edge case: offer to create if missing, or error
  with --no-create-space flag

P3:
- Frontend YAML parser dependency noted (js-yaml or equivalent)
- --yes CI/CD safety note: prompt injection risk documented
- Command allowlist location: BOSS_COMMAND_ALLOWLIST env var
- Concurrent import: 409 treated as already-done, safe to continue
- --restart-changed uses pre-apply diff to avoid concurrent-change races

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsell-rh jsell-rh force-pushed the feat/agent-compose-spec-task098 branch from e88e1cb to 599cc8a Compare March 17, 2026 20:14
@jsell-rh jsell-rh merged commit fe7a443 into main Mar 17, 2026
3 checks passed
@jsell-rh jsell-rh deleted the feat/agent-compose-spec-task098 branch March 17, 2026 20:15
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