agent-orchestrator/packages/core/src
prateek 90111da18d
feat: layered prompt system for agent sessions (#27)
* feat: implement layered prompt system for agent sessions

Replace hardcoded spawn prompts with a 3-layer composition system:
- Layer 1: BASE_AGENT_PROMPT constant with session lifecycle, git workflow, PR handling
- Layer 2: Config-derived context (project, repo, tracker, issue details via generatePrompt())
- Layer 3: User-customizable rules via agentRules (inline) and agentRulesFile (path)

The session-manager path fetches issue context from the tracker plugin and passes
the composed prompt via AgentLaunchConfig.prompt. The CLI spawn path delivers it
via tmux send-keys to keep agents interactive for follow-up messages.

Returns null when nothing to compose (no issue, no rules), preserving backward
compatibility for bare launches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use tmuxSendKeys for multi-line prompt delivery in CLI spawn

The buildPrompt() output contains newlines which tmux send-keys -l treats
as Enter keypresses, splitting the prompt into separate submissions. Use
the core tmuxSendKeys() helper which handles multi-line text via
load-buffer/paste-buffer.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: update spawn test to verify tmuxSendKeys usage

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:07:13 +05:30
..
__tests__ feat: layered prompt system for agent sessions (#27) 2026-02-14 20:07:13 +05:30
config.ts feat: layered prompt system for agent sessions (#27) 2026-02-14 20:07:13 +05:30
index.ts feat: layered prompt system for agent sessions (#27) 2026-02-14 20:07:13 +05:30
lifecycle-manager.ts fix: detect agent exit for all agent types, not just idle-reporting ones (#22) 2026-02-14 16:52:46 +05:30
metadata.ts fix: remove sessions/ subdirectory from metadata paths (#24) 2026-02-14 17:28:58 +05:30
plugin-registry.ts feat: notifier-composio plugin + integration tests for all plugins (#7) 2026-02-14 16:29:59 +05:30
prompt-builder.ts feat: layered prompt system for agent sessions (#27) 2026-02-14 20:07:13 +05:30
session-manager.ts feat: layered prompt system for agent sessions (#27) 2026-02-14 20:07:13 +05:30
tmux.ts fix: restrict temp file permissions, validate session prefix format 2026-02-14 05:17:53 +05:30
types.ts feat: layered prompt system for agent sessions (#27) 2026-02-14 20:07:13 +05:30
utils.ts feat: notifier-composio plugin + integration tests for all plugins (#7) 2026-02-14 16:29:59 +05:30