> 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/phase38-session09-intelligence-portal/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase38-session09-intelligence-portal` **Reviewed**: 2026-06-30 **Scope**: All uncommitted changes in the working tree **Result**: RESOLVED

## Review Surface

**Files reviewed** (all uncommitted changes):

* `.spec_system/specs/phase38-session09-intelligence-portal/code-review.md` - untracked report
* `.spec_system/specs/phase38-session09-intelligence-portal/implementation-notes.md` - untracked
* `.spec_system/specs/phase38-session09-intelligence-portal/spec.md` - untracked
* `.spec_system/specs/phase38-session09-intelligence-portal/tasks.md` - untracked
* `.spec_system/state.json` - tracked-modified
* `docs/intelligence-view.md` - tracked-modified
* `docs/local-voice-setup.md` - tracked-modified
* `src/components/hermes/__tests__/hermes-documents-gallery.test.tsx` - tracked-modified
* `src/components/hermes/__tests__/hermes-mission-control.test.tsx` - tracked-modified
* `src/components/hermes/__tests__/hermes-sections.test.tsx` - tracked-modified
* `src/components/hermes/chat/__tests__/hermes-chat-tab.test.tsx` - tracked-modified
* `src/components/hermes/chat/hermes-chat-tab.tsx` - tracked-modified
* `src/components/hermes/hermes-read-only-page.tsx` - tracked-modified
* `src/components/hermes/intelligence/__tests__/intelligence-portal.test.tsx` - untracked
* `src/components/hermes/intelligence/__tests__/visualizers.test.tsx` - untracked
* `src/components/hermes/intelligence/hermes-mind-3d.tsx` - untracked
* `src/components/hermes/intelligence/index.ts` - untracked
* `src/components/hermes/intelligence/intelligence-portal.tsx` - untracked
* `src/components/hermes/intelligence/intelligence-types.ts` - untracked
* `src/components/hermes/intelligence/oracle-plasma.tsx` - untracked
* `src/components/hermes/intelligence/oracle-rider.tsx` - untracked
* `src/components/hermes/intelligence/oracle-sonar.tsx` - untracked
* `src/components/hermes/intelligence/oracle-waveform.tsx` - untracked
* `src/components/hermes/intelligence/stage-aurora.tsx` - untracked
* `src/components/hermes/intelligence/stage-cosmos.tsx` - untracked
* `src/components/knowledge-graph/__tests__/knowledge-graph-grounded-chat.test.tsx` - tracked-modified
* `src/hooks/__tests__/use-hermes-admin.test.tsx` - tracked-modified
* `src/hooks/__tests__/use-hermes-intelligence-voice.test.tsx` - untracked
* `src/hooks/use-hermes-admin.ts` - tracked-modified
* `src/hooks/use-hermes-intelligence-voice.ts` - untracked
* `src/lib/__tests__/hermes-intelligence-events.test.ts` - untracked
* `src/lib/hermes-intelligence-events.ts` - untracked
* `src/lib/mind-map.ts` - untracked
* `src/lib/synthetic-voice.ts` - untracked
* `tests/e2e/hermes-intelligence.spec.ts` - untracked

**Inventory commands**: `git status`, `git diff HEAD`, `git diff --cached`, `git ls-files --others --exclude-standard`

## Findings by Severity

### Critical

* No findings.

### High

* No findings.

### Medium

* `src/components/hermes/intelligence/stage-aurora.tsx:131`, `src/components/hermes/intelligence/stage-cosmos.tsx:121`, `src/components/hermes/intelligence/oracle-plasma.tsx:53` - Animated canvas stages scheduled a frame inside the draw function and also scheduled a second frame after the immediate first draw. This could create duplicate animation loops, extra work, and an uncanceled frame chain after unmount. | Fix: split drawing from the RAF loop, keep resize redraws synchronous, and schedule one loop per mounted stage. Added coverage that asserts one RAF is created and canceled for Aurora, Cosmos, and Plasma. | Status: FIXED
* `src/hooks/use-hermes-intelligence-voice.ts:489`, `src/components/hermes/intelligence/intelligence-portal.tsx:249` - Voice start was guarded only while the startup request was in flight. After the hook reached `listening`, another Start action could create a second peer/data channel/media stream. | Fix: make `start()` return `false` when an active runtime ref already exists and disable the Start control during active voice phases. Added hook and portal tests. | Status: FIXED

### Low

* `src/components/hermes/intelligence/intelligence-portal.tsx:349` - The design-mode segmented control used `role="tablist"` while its children used `aria-pressed` buttons, which did not match the actual interaction pattern. | Fix: changed the container role to `group`. | Status: FIXED
* `.spec_system/specs/phase38-session09-intelligence-portal/spec.md:59`, `.spec_system/specs/phase38-session09-intelligence-portal/implementation-notes.md:51` - New session documentation recorded actual local checkout paths. | Fix: replaced machine-specific paths with stable placeholders such as `<local-claudeos-checkout>` and `<apex-spec-skill>`. | Status: FIXED
* `.spec_system/specs/phase38-session09-intelligence-portal/*.md` - New session markdown files did not pass the repository Prettier check. | Fix: formatted the session markdown files with Prettier. | Status: FIXED

## Assumptions and Deliberate Non-Fixes

* Existing Hermes tests contain synthetic `/home/operator/...`, fake `Bearer`, and fake `secret-token` strings to verify redaction behavior. These are not actual local paths or credentials, and the tests assert that product surfaces do not expose them. They were left unchanged.
* Live provider voice was not exercised with real credentials. The browser proof used mocked `/__hermes_chat` and guarded recovery states, matching the session docs' verification limit.
* `src/data/live-data.json` remained generated and gitignored; seed/build commands left it unchanged, so it was not part of the review surface.

## Behavior Changes

* Fixed animation lifecycle behavior so Aurora, Cosmos, and Plasma each own one RAF loop and clean it up on unmount.
* Fixed voice lifecycle behavior so a live Realtime loop cannot be started twice without stopping the existing runtime first.
* Corrected the design-mode segmented control accessibility role.
* Redacted machine-local paths from the new session docs.

## Verification

* Tests: `bun run test -- src/hooks/__tests__/use-hermes-admin.test.tsx src/hooks/__tests__/use-hermes-intelligence-voice.test.tsx src/lib/__tests__/hermes-intelligence-events.test.ts src/components/hermes/intelligence/__tests__/intelligence-portal.test.tsx src/components/hermes/intelligence/__tests__/visualizers.test.tsx src/components/hermes/chat/__tests__/hermes-chat-tab.test.tsx` - PASS - 6 files, 63 tests
* Tests: `bun run test` - PASS - 402 files, 4591 tests
* Browser: `bunx playwright test tests/e2e/hermes-intelligence.spec.ts --project=chromium` - PASS - 2 tests
* Linter: `bun run lint` - PASS
* Formatter: `bun run format:check` - PASS
* Type checker: `bun run typecheck` - PASS
* Script type checker: `bun run typecheck:scripts` - PASS
* Build: `bun run build` - PASS
* Whitespace: `git diff --check` - PASS
* ASCII/LF: changed-file non-ASCII and CRLF scans - PASS
* Secret and path sweep: actual local-path and secret-shaped scans - PASS after redacting new session docs; remaining hits are the deliberate synthetic redaction-test fixtures noted above
* Final diff re-read: no remaining review findings

## Summary

1. Reviewed 34 implementation files plus this generated review report, covering the Hermes Intelligence portal, voice hook, event mapper, route integration, docs, unit tests, and Playwright proof.
2. Findings: 0 critical, 0 high, 2 medium, 3 low; all resolved.
3. Deliberately left existing synthetic redaction fixtures unchanged because they are test evidence, not real secrets or local paths.
4. Verification passed for focused tests, full Vitest, Playwright proof, lint, format, app/script typecheck, build, whitespace, ASCII/LF, and secret/path sweeps.


---

# 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/phase38-session09-intelligence-portal/code-review.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.
