> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase25-session05-full-prompt-drawer-copy-briefings/spec.md).

# Session Specification

**Session ID**: `phase25-session05-full-prompt-drawer-copy-briefings` **Phase**: 25 - Hermes Mission Control Activation **Status**: Not Started **Created**: 2026-06-08

***

## 1. Session Overview

This session makes active Mission Control mini-goals actionable instead of summary-only cards. Session 04 delivered multi-goal authoring and optimized preview commit, so active missions can now contain the `full_prompt` content that tells a Hermes or Claude Code agent what to execute and tells a human operator what briefing to follow.

The core deliverable is a no-layout-shift goal detail sheet that exposes each mini-goal's `full_prompt`, keeps long text wrapped and bounded, and provides copy actions directly from both the card and the detail sheet. Agent goals copy a valid `/goal` prompt with prefix correction and the v2.3 guard line that tells the executing agent not to self-tick Mission Control. Human goals copy a readable briefing, rendering structured sections when available and falling back to prose otherwise.

The implementation must preserve AI OS safety boundaries. This session adds no new bridge endpoint and no write contract change; it only projects already typed `HermesMissionGoal` data in the browser, uses the existing admin-gated tick/clear paths unchanged, keeps Hermes and Claude Code behavior at contract parity, and tests clipboard, drawer, prefix, fallback, and overflow behavior.

***

## 2. Objectives

1. Expose `full_prompt` for every active mini-goal through an accessible no-layout-shift detail sheet with bounded scrolling and strong wrapping.
2. Add shared copy builders for agent `/goal` prompts and human briefings, including prefix safety and the no-self-tick guard line.
3. Render structured human briefings as labeled sections with a prose fallback for unstructured `full_prompt` text.
4. Prove card actions, sheet actions, copy output, fallback behavior, reset on close, clipboard failure handling, and Hermes/Claude Code parity with focused tests.

***

## 3. Prerequisites

### Required Sessions

* [x] `phase25-session02-mission-schema-version-legacy-compatibility` - provides normalized mission documents with typed `full_prompt` fields.
* [x] `phase25-session04-multi-goal-authoring-preview-ui` - provides active multi-goal mission cards and optional `full_prompt` authoring state.

### Required Tools/Knowledge

* Bun 1.3.14 project toolchain.
* React 19, TypeScript 6, TanStack Query, Tailwind CSS 4, and local Hermes page primitives.
* Radix-backed `Sheet`/`Dialog` conventions for focus trap, escape close, and focus return.
* Testing Library and Vitest component-test conventions.
* Existing Mission Control state, presentation copy, redaction helpers, and `HermesMissionGoal` contract.

### Environment Requirements

* Work from the repository root.
* No live Hermes credentials are required; tests should use mocked mission data and mocked clipboard behavior.
* Generated private Hermes data, `.env*`, logs, real tokens, and local mission files remain out of git.

***

## 4. Scope

### In Scope (MVP)

* Operators can open a mini-goal detail sheet without shifting the active mission card grid - use an overlay/sheet with focus trap, escape close, focus return, and reset on close.
* Operators can inspect every mini-goal `full_prompt` - render long prompt text with preserved line breaks, bounded height, scroll containment, and no horizontal overflow.
* Operators can copy an agent execution prompt - agent goals copy through a shared builder that guarantees a `/goal` prefix and appends the no-self-tick Mission Control guard line.
* Operators can copy a human briefing - human goals copy through the same helper boundary and return readable briefing text.
* Operators can read structured human briefings - parse and render the 8 v2.3 sections when present, with prose fallback for unstructured `full_prompt`.
* Card and sheet actions share copy output - no duplicated string builders or actor-specific copy drift between surfaces.
* Clipboard failure stays explicit - show a bounded fallback message when `navigator.clipboard.writeText` is unavailable or rejects.
* Hermes and Claude Code presentations remain at parity - only labels and presentation copy differ.

### Out of Scope (Deferred)

* One-goal rail navigation and gradient milestone progress - Reason: Session 06 owns active mission rail focus and milestone-accurate progress.
* Mission archive reactivation or delete actions - Reason: Session 07 owns archive actions.
* New agent types beyond `hermes` and `human` - Reason: the finalized Phase 25 actor set remains bounded to existing contracts.
* Bridge endpoints, mission write contracts, or storage migrations - Reason: this session projects already typed mission data and adds no persistence path.
* Full responsive/e2e parity sweep - Reason: Session 08 owns route-wide responsive and e2e coverage; this session adds focused component coverage and manual overflow checks.

***

## 5. Technical Approach

### Architecture

Create a pure helper module under `src/lib/` for Mission Control copy and briefing behavior. The helper should accept typed `HermesMissionGoal` data, return deterministic copy text, report whether `/goal` prefix correction was needed, and parse structured human briefing blocks without touching browser APIs.

Create a focused Hermes component for the goal detail sheet under `src/components/hermes/`. The component should be presentational: it receives the selected goal, actor labels, parsed human briefing blocks, copy callbacks, and close state from `HermesMissionControl`. It should use existing UI primitives and preserve dense Hermes styling without creating nested cards.

Update `src/components/hermes/hermes-mission-control.tsx` to own selected-goal state, shared copy feedback, clipboard writes, card copy buttons, card detail buttons, and sheet open/close reset. Existing create, optimize, import, tick, clear, refresh, admin-gate, and query invalidation behavior must remain unchanged.

### Design Patterns

* Pure helper first: copy strings and briefing parsing stay unit-testable outside the component.
* Presentational sheet: detail UI receives typed props and does not fetch, write, or parse raw bridge payloads.
* Shared copy path: card and sheet actions call the same builder and the same clipboard wrapper.
* Prefix correction: agent copy output always starts with `/goal` even when stored `full_prompt` omits it.
* Reset on re-entry: selected goal, detail sheet state, and copy feedback reset on close, demo-mode changes, and presentation changes.
* Bounded UI: long prompt/briefing content stays wrapped, scroll-contained, and accessible from keyboard and touch inputs.
* Presentation parity: Hermes and Claude Code differ only through the existing presentation labels.

### Technology Stack

* TypeScript 6.0.3.
* React 19.
* TanStack Query 5 through existing mission query keys and invalidation.
* Tailwind CSS 4 and existing Hermes page primitives.
* Radix-backed local `Sheet` or `Dialog` primitives.
* Vitest 4.1.6 and Testing Library.

***

## 6. Deliverables

### Files to Create

| File                                                                                             | Purpose                                                                                                     | Est. Lines |
| ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- | ---------- |
| `src/lib/hermes-mission-briefings.ts`                                                            | Shared copy-text builders, `/goal` prefix safety, no-self-tick guard, and structured human briefing parser. | \~180      |
| `src/lib/__tests__/hermes-mission-briefings.test.ts`                                             | Unit coverage for agent copy, prefix correction, guard line, structured briefings, and prose fallback.      | \~180      |
| `src/components/hermes/hermes-mission-goal-detail.tsx`                                           | Accessible goal detail sheet rendering full prompts, structured human briefing sections, and copy actions.  | \~220      |
| `.spec_system/specs/phase25-session05-full-prompt-drawer-copy-briefings/implementation-notes.md` | Implementation decisions, command output, and known follow-ups.                                             | \~80       |
| `.spec_system/specs/phase25-session05-full-prompt-drawer-copy-briefings/security-compliance.md`  | Session security review for prompt projection, clipboard behavior, and unchanged admin-gated writes.        | \~80       |

### Files to Modify

| File                                                              | Changes                                                                                                                                                                | Est. Lines |
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `src/components/hermes/hermes-mission-control.tsx`                | Add selected-goal state, card detail/copy actions, shared clipboard handling, detail sheet integration, and reset behavior.                                            | \~260      |
| `src/components/hermes/__tests__/hermes-mission-control.test.tsx` | Cover detail sheet open/close, focus/access labels, card and sheet copy output, prefix correction, human briefing fallback, clipboard failure, and Claude Code parity. | \~280      |

***

## 7. Success Criteria

### Functional Requirements

* [ ] Every active mini-goal exposes its `full_prompt` through a detail sheet.
* [ ] Long `full_prompt` content preserves useful line breaks, wraps without horizontal overflow, and stays bounded inside a scrollable region.
* [ ] Agent goal card and sheet copy actions write a valid `/goal` -prefixed prompt.
* [ ] Agent copy output includes a guard line telling the executing agent not to self-tick Mission Control.
* [ ] Agent copy actions correct missing `/goal` prefixes and show clear feedback when correction happened.
* [ ] Human goal card and sheet copy actions write a readable briefing.
* [ ] Structured human briefings render labeled sections for the 8 v2.3 labels.
* [ ] Unstructured human `full_prompt` text falls back to prose display and copy.
* [ ] Detail sheet close resets selected-goal state and returns the operator to the card context without layout shift.
* [ ] Existing tick, clear, create, optimize, import, refresh, and admin-gate behavior remains unchanged.

### Testing Requirements

* [ ] Unit tests cover copy builders for agent and human goals.
* [ ] Unit tests cover missing `/goal` prefix correction and the guard line.
* [ ] Unit tests cover structured 8-section human briefing parsing and prose fallback.
* [ ] Component tests cover card detail open/close and selected-goal reset.
* [ ] Component tests cover card copy and sheet copy for both actors.
* [ ] Component tests cover clipboard rejection fallback.
* [ ] Component tests cover Hermes and Claude Code presentation parity for copy labels and detail actions.

### Non-Functional Requirements

* [ ] No new bridge endpoint, storage path, or write contract is introduced.
* [ ] Admin gate strength is unchanged; tick/clear writes remain loopback, token, admin-mode, non-demo, and hook-mediated.
* [ ] Browser-visible copy feedback contains no token, auth header, local path, or raw bridge error detail.
* [ ] UI remains dense, scannable, keyboard reachable, touch friendly, and consistent with Hermes Mission Control styling.
* [ ] Prompt and briefing text cannot create document-level horizontal overflow on mobile or desktop.

### Quality Gates

* [ ] All files ASCII-encoded.
* [ ] Unix LF line endings.
* [ ] Code follows project conventions.
* [ ] Focused tests pass.
* [ ] `bun run typecheck` passes.
* [ ] `bun run lint` passes.

***

## 8. Implementation Notes

### Key Considerations

* `HermesMissionGoal.full_prompt` is already present in the read contract. This session should not widen the bridge, scanner, parser, or admin request shape.
* `HermesMissionControl` is already large. Keep string building and briefing parsing in `src/lib/hermes-mission-briefings.ts`, and keep sheet rendering in a focused component to avoid turning the active mission panel into a parsing surface.
* Clipboard writes should be the only browser side effect added here. Copy output can include mission execution text, but feedback should remain bounded and should not echo full prompt content back into status messages.
* The detail sheet should use existing Radix-backed primitives so focus trap, escape close, and focus return are provided by the local UI system.

### Potential Challenges

* Long prompt overflow: mitigate with `whitespace-pre-wrap`, `break-words`, `overflow-x-hidden`, and a bounded scroll container.
* Prefix drift: mitigate by unit-testing the copy builder and routing both card and sheet copy through that function.
* Human briefing format variance: mitigate by accepting canonical labels with flexible whitespace and falling back to prose when all sections cannot be identified.
* Component test brittleness: mitigate by testing visible behavior and clipboard output instead of class implementation details.

### Relevant Considerations

* \[P04] **Hermes bridge guardrails must stay intact**: This session adds no bridge endpoint and keeps tick/clear writes on the existing hook-mediated admin path.
* \[P20] **Long-tail Hermes surfaces stay modular and prop-driven**: The detail sheet should be a focused prop-driven component instead of more inline card complexity.
* \[P23] **Hermes hook reuse for related agent routes**: Hermes and Claude Code Mission Control should share copy/building behavior and differ only in labels.
* \[P17] **Reuse existing hook contracts for write surfaces**: No component-level fetches or new write abstractions should be introduced.
* \[P08] **Playwright route interception plus DOM rect checks**: Manual overflow checks should use stable visible content before measuring responsive layout.

### Behavioral Quality Focus

Checklist active: Yes

Top behavioral risks for this session:

* Agent prompts could be copied without `/goal` prefix or without the no-self-tick guard.
* Detail sheet state could leak across close/reopen, demo-mode changes, or Hermes/Claude Code presentation changes.
* Long prompt or briefing text could create horizontal overflow or trap content outside the viewport.
* Clipboard rejection could leave the operator with no clear fallback.

***

## 9. Testing Strategy

### Unit Tests

* Test `buildMissionGoalCopyText` or equivalent for agent goals with existing `/goal` prefix, missing prefix, empty prompt fallback, and guard-line output.
* Test human briefing copy output for structured 8-section content and prose fallback.
* Test structured briefing parser ordering, label normalization, and empty section handling.

### Integration Tests

* Extend `hermes-mission-control.test.tsx` to render active Hermes missions, click card detail buttons, verify sheet content, close/reset state, and assert card/sheet copy clipboard writes for both actors.
* Cover Claude Code presentation labels while asserting the same copy output and no additional admin calls.
* Cover clipboard rejection with bounded fallback feedback.

### Manual Testing

* Run a local active mission fixture with long agent and human `full_prompt` text; open the detail sheet on desktop and mobile widths and confirm no document-level horizontal overflow.
* Verify keyboard traversal reaches detail and copy buttons, escape closes the sheet, and focus returns to the triggering card control.

### Edge Cases

* Empty or whitespace-only `full_prompt`.
* Agent `full_prompt` missing `/goal` prefix.
* Agent `full_prompt` already containing `/goal` with extra leading spaces.
* Human `full_prompt` with all 8 structured labels.
* Human `full_prompt` with partial or unstructured prose.
* Clipboard unavailable, rejected, or missing in test/browser environment.

***

## 10. Dependencies

### External Libraries

* `@radix-ui/react-dialog`: Existing local `Sheet`/`Dialog` primitive base.
* `lucide-react`: Existing icon library for detail and copy buttons.
* `@testing-library/react`: Existing component test harness.
* `vitest`: Existing unit and component test runner.

### Internal Dependencies

* `src/components/hermes/hermes-mission-control.tsx`
* `src/components/hermes/hermes-page-primitives.tsx`
* `src/components/ui/button.tsx`
* `src/components/ui/sheet.tsx`
* `src/components/ui/scroll-area.tsx`
* `src/lib/hermes-types.ts`
* `src/lib/hermes-mission-authoring.ts`
* `src/hooks/use-hermes-admin.ts`

### Other Sessions

* **Depends on**: `phase25-session02-mission-schema-version-legacy-compatibility`, `phase25-session04-multi-goal-authoring-preview-ui`
* **Depended by**: `phase25-session06-active-mission-rail-progress`, `phase25-session08-claude-code-parity-responsive-e2e`, `phase25-session09-documentation-validation-release`

***

## Next Steps

Run the implement workflow step to begin AI-led implementation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase25-session05-full-prompt-drawer-copy-briefings/spec.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
