> 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/phases/phase_26/session_07_hermes_chat_grounding_graph_toolset.md).

# Session 07: Hermes Chat Grounding And Graph Toolset

**Session ID**: `phase26-session07-hermes-chat-grounding-graph-toolset` **Status**: Complete **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Make the existing Hermes chat reusable and groundable so it can run inside the Knowledge Graph page against the active project's graph: add seed context, prefill, a grounding chip, and `toolsets`/`yolo` forwarding plus the graphify skill, without weakening the admin gate.

***

## Scope

### In Scope (MVP)

* Make the existing AI OS Hermes chat component reusable with optional Knowledge Graph props: `seedContext`, `seedLabel`, `seedAccent`, `yolo`. Upstream exports from a route monolith; AI OS should extend `src/components/hermes/chat/*` and existing hooks instead of re-monolithing `agents.hermes.tsx`.
* Invisible seed-context prefix prepended only on the first turn.
* `hermes-chat-prefill` event listener to receive starter-chip prompts.
* Visible "Chatting with X" grounding chip.
* Forward `toolsets` and `yolo` to `/__hermes_chat` through `src/hooks/use-hermes-admin.ts`; in `scripts/lib/hermes-admin-bridge.ts` append `-t <toolsets>` and `--yolo -s graphify` to the Hermes argv (argv array only).
* Unique session-list key fix; assistant-bubble readability/markdown parity if needed for the grounded view.
* Mount the grounded chat in the Knowledge Graph page with seed context (active graphPath + graphify commands).
* Tests for seed prefix, prefill, chip, and toolsets/yolo payload.

### Out of Scope

* Changing the Mission Control or other Hermes write contracts.
* New unauthenticated chat/write surfaces.

***

## Prerequisites

* [ ] Session 05 page surface available.
* [ ] Session 06 starter chips dispatch `hermes-chat-prefill`.
* [ ] Hermes chat foundation confirmed in `src/components/hermes/chat/`.

***

## Deliverables

1. Reusable, groundable Hermes chat component (KG props on existing chat module).
2. `use-hermes-admin.ts` toolsets/yolo forwarding.
3. `hermes-admin-bridge.ts` argv append (`-t`, `--yolo -s graphify`).
4. Grounded chat mounted in the Knowledge Graph page.
5. Tests.

***

## Success Criteria

* [ ] Hermes chat mounts inside `/knowledge-graph` grounded on the active graph.
* [ ] First-turn seed context is applied invisibly; chip prefill works.
* [ ] Grounding chip shows the active project.
* [ ] `toolsets`/`yolo` reach the bridge and append argv flags; the admin gate is unchanged.
* [ ] Tests cover seed/prefill/chip/payload.

***

## Folded Port Detail

### Source Project Reference Links

#### AI OS Targets

* [Hermes chat components](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/aios/src/components/hermes/chat/README.md)
* [Hermes chat tab](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/aios/src/components/hermes/chat/hermes-chat-tab.tsx)
* [Hermes admin hook (chat stream)](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/aios/src/hooks/use-hermes-admin.ts)
* [Hermes admin bridge (chat argv)](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/aios/scripts/lib/hermes-admin-bridge.ts)
* [Hermes route](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/aios/src/routes/agents.hermes.tsx)
* [Knowledge Graph page from Session 05](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/aios/src/components/knowledge-graph/knowledge-graph-page.tsx)

#### Claude OS v2.4 Reference

* [Reference Hermes route changes](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/claudeos/claude-os-v2.4/src/routes/agents.hermes.tsx)
* [Reference chat bridge changes](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/claudeos/claude-os-v2.4/vite.config.ts)
* [Reference codegraph chat mount](https://github.com/moshehbenavraham/ai-os/blob/main/home/aiwithapex/projects/claudeos/claude-os-v2.4/src/routes/codegraph.tsx)

### Reference (v2.4)

* `ReactNode` import: `v2.4/src/routes/agents.hermes.tsx:3`.
* `useHermesStatus` export in upstream route monolith: `v2.4/src/routes/agents.hermes.tsx:956` (AI OS maps this to existing `use-hermes`/component composition).
* `HermesChat` export + optional KG props: `v2.4/src/routes/agents.hermes.tsx:2115-2173`.
* Active prop plumbing: `v2.4/src/routes/agents.hermes.tsx:2176-2190`.
* `hermes-chat-prefill` listener: `v2.4/src/routes/agents.hermes.tsx:2218-2230`.
* First-turn invisible seed prefix: `v2.4/src/routes/agents.hermes.tsx:2421-2427`.
* `toolsets`/`yolo` forwarded: `v2.4/src/routes/agents.hermes.tsx:2468-2477`.
* Grounding chip: `v2.4/src/routes/agents.hermes.tsx:2634-2649`.
* Session-list key `${s.id}-${sidx}`: `v2.4/src/routes/agents.hermes.tsx:2981-2987`.
* Assistant bubble + `ChatMarkdown`: `v2.4/src/routes/agents.hermes.tsx:3215-3355`.
* `/__hermes_chat` adds `toolsets`/`yolo`: `v2.4/vite.config.ts:953-1019`.
* Hermes args append `-t <toolsets>` and `--yolo -s graphify`: `v2.4/vite.config.ts:1084-1092`.
* Grounded chat mount with seed context: `v2.4/src/routes/codegraph.tsx:201-216, 521-582`.

### Build Steps

1. Add optional KG props (`seedContext`, `seedLabel`, `seedAccent`, `yolo`) to the existing AI OS chat module and expose only the minimal reusable API needed by the Knowledge Graph page.
2. Add the first-turn invisible seed prefix and the `hermes-chat-prefill` listener.
3. Add the grounding chip and unique session-list key.
4. Forward `toolsets`/`yolo` through `use-hermes-admin.ts` to `/__hermes_chat`.
5. Append `-t <toolsets>` and `--yolo -s graphify` to the Hermes argv in `hermes-admin-bridge.ts` (argv array, no shell string), keeping the admin gate.
6. Mount the grounded chat in the Knowledge Graph page with active graph context.
7. Write tests for seed/prefill/chip/payload.

### Exit Criteria

* Grounded Hermes chat runs inside `/knowledge-graph` with seed context, prefill, chip, and toolsets/yolo forwarding, on the unchanged admin gate, all tested.


---

# 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/phases/phase_26/session_07_hermes_chat_grounding_graph_toolset.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.
