Parent: #398
Goal
Add the non-UI spine for curated launch context: selected project-relative paths, bounded file reads, assembled XML-tagged context, and launch prompt composition.
Implementation Notes
Introduce a small context model and assembly layer before building richer UI.
Suggested types:
ContextSelection: selected paths, optional slices placeholder, code-map path placeholder, include-git-diff flag
ContextSection: file map, file contents, git diff, user instructions
ContextAssembler: builds the exact prompt block from selection + file contents + user instructions
ContextAccountant actor or equivalent: resolves selected file contents off-main with bounded concurrency
Launch integration target: CLISessionsViewModel.startNewSessionInHub. Add an optional contextBlock parameter and combine it with initialPrompt before routing to Claude terminal submission or Codex process launch.
For large assembled context, write a temp markdown file under AgentHub-owned temp/application-support space and pass a prompt reference to that file instead of pasting a huge block.
Acceptance Criteria
- Given three selected files, the assembler produces a deterministic block containing those files under structured tags.
startNewSessionInHub can receive contextBlock and prepends it to the user prompt.
- Empty context preserves existing launch behavior.
- Oversized context uses a temp-file reference instead of inlining.
- File reads do not happen on
@MainActor.
Tests
Add focused tests for assembly output, empty selection, missing/unreadable file behavior, and temp-file fallback.
Run targeted AgentHubCore tests for the new suite plus any existing launch tests touched.
Parent: #398
Goal
Add the non-UI spine for curated launch context: selected project-relative paths, bounded file reads, assembled XML-tagged context, and launch prompt composition.
Implementation Notes
Introduce a small context model and assembly layer before building richer UI.
Suggested types:
ContextSelection: selected paths, optional slices placeholder, code-map path placeholder, include-git-diff flagContextSection: file map, file contents, git diff, user instructionsContextAssembler: builds the exact prompt block from selection + file contents + user instructionsContextAccountantactor or equivalent: resolves selected file contents off-main with bounded concurrencyLaunch integration target:
CLISessionsViewModel.startNewSessionInHub. Add an optionalcontextBlockparameter and combine it withinitialPromptbefore routing to Claude terminal submission or Codex process launch.For large assembled context, write a temp markdown file under AgentHub-owned temp/application-support space and pass a prompt reference to that file instead of pasting a huge block.
Acceptance Criteria
startNewSessionInHubcan receivecontextBlockand prepends it to the user prompt.@MainActor.Tests
Add focused tests for assembly output, empty selection, missing/unreadable file behavior, and temp-file fallback.
Run targeted AgentHubCore tests for the new suite plus any existing launch tests touched.