> 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/phase40-session09-model-intelligence-and-pricing/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase40-session09-model-intelligence-and-pricing` **Reviewed**: 2026-07-03 **Base Commit**: 925db249efec9b21eb95479415966d7b8586f5eb **Scope**: All changes since the base commit (uncommitted work plus mid-session commits) **Result**: RESOLVED

## Review Surface

**Files reviewed** (all changes since the base commit):

* `.spec_system/state.json` - tracked-modified
* `.spec_system/specs/phase40-session09-model-intelligence-and-pricing/spec.md` - untracked text
* `.spec_system/specs/phase40-session09-model-intelligence-and-pricing/tasks.md` - untracked text
* `.spec_system/specs/phase40-session09-model-intelligence-and-pricing/implementation-notes.md` - untracked text
* `.spec_system/specs/phase40-session09-model-intelligence-and-pricing/code-review.md` - untracked creview artifact
* `scripts/lib/hermes-dev-bridge.ts` - tracked-modified
* `scripts/lib/hermes-model-intelligence.ts` - untracked text
* `scripts/lib/__tests__/hermes-dev-bridge.test.ts` - tracked-modified
* `scripts/lib/__tests__/hermes-model-intelligence.test.ts` - untracked text
* `src/lib/hermes-types.ts` - tracked-modified
* `src/lib/hermes-model-intelligence.ts` - untracked text
* `src/lib/hermes-demo-data.ts` - tracked-modified
* `src/lib/__tests__/hermes-types.test.ts` - tracked-modified
* `src/lib/__tests__/hermes-model-intelligence.test.ts` - untracked text
* `src/hooks/use-hermes.ts` - tracked-modified
* `src/hooks/__tests__/use-hermes.test.tsx` - tracked-modified
* `src/components/hermes/hermes-read-only-page.tsx` - tracked-modified
* `src/components/hermes/hermes-status-bar.tsx` - tracked-modified
* `src/components/hermes/__tests__/hermes-sections.test.tsx` - tracked-modified

**Inventory commands**: `git status`, `git log --oneline "$BASE"..HEAD`, `git diff "$BASE"`, `git diff --cached "$BASE"`, `git ls-files --others --exclude-standard`

There were no mid-session commits and no staged changes. All untracked files were text files and were read directly; no binary or generated untracked files needed byte-level inspection.

## Findings by Severity

### Critical

No findings.

### High

No findings.

### Medium

* `src/components/hermes/hermes-status-bar.tsx:204`
  * The status-bar Ministry summary used the body-level pricing provenance to say all rows used live pricing. Partial OpenRouter overlays can return live pricing for only some rows while the rest use bundled snapshot fallback, so the product copy could overstate live pricing coverage.
  * Fix: Counted per-row `openrouter-live` pricing sources and render `live pricing`, `mixed live and snapshot pricing`, or `snapshot pricing` from row-level evidence.
  * Status: FIXED

### Low

* `scripts/lib/__tests__/hermes-dev-bridge.test.ts:89`
  * The bridge test helper allowed the new model-intelligence endpoint to use production-default live pricing unless each test disabled it. Public-read route coverage could therefore make a real OpenRouter request, making the test suite network-dependent and slower.
  * Fix: Disabled live pricing by default in the test route helper and made the live-pricing endpoint test opt in with an injected mock fetch.
  * Status: FIXED
* `.spec_system/specs/phase40-session09-model-intelligence-and-pricing/spec.md:1`
  * The current session `spec.md` and `implementation-notes.md` failed the review-surface Prettier check.
  * Fix: Ran Prettier on those two current-session artifacts only.
  * Status: FIXED

## Assumptions and Deliberate Non-Fixes

* `bun run format:check` still fails on 33 older `.spec_system` Markdown files outside this session's review surface. Those files were not changed by this session, and rewriting them would violate the creview scope rule. A targeted Prettier check over every review-surface file passes.
* The generated `spec.md` status and next-step text still reflect the plansession template, matching prior phase artifacts. The authoritative current workflow handoff is this creview report and the command output.

## Behavior Changes

* The Hermes status bar now reports partial live pricing as `mixed live and snapshot pricing` instead of implying every Ministry row used live pricing. This is an observable copy correction for partial live overlays.

## Verification

* Tests: `bun run test` - PASS - 413 test files passed, 4737 tests passed.
* Tests: `bunx vitest run scripts/lib/__tests__/hermes-model-intelligence.test.ts scripts/lib/__tests__/hermes-dev-bridge.test.ts src/lib/__tests__/hermes-model-intelligence.test.ts src/lib/__tests__/hermes-types.test.ts src/hooks/__tests__/use-hermes.test.tsx src/components/hermes/__tests__/hermes-sections.test.tsx` - PASS - 6 test files passed, 147 tests passed.
* Linter: `bun run lint` - PASS.
* Formatter: `bunx prettier --check [review-surface files]` - PASS.
* Formatter: `bun run format:check` - FAIL - 33 out-of-scope pre-existing `.spec_system` Markdown files; no Session 09 review-surface file remains listed after targeted formatting.
* Type checker: `bun run typecheck` - PASS.
* Type checker: `bun run typecheck:scripts` - PASS.
* Whitespace: `git diff --check` - PASS.
* Encoding: ASCII/LF scan over all review-surface files - PASS.
* Final diff re-read: no remaining in-scope issues.

## Summary

1. Reviewed 19 files since base commit `925db249efec9b21eb95479415966d7b8586f5eb`, including 11 tracked code/test/state files, 7 untracked implementation artifacts, and this creview report.
2. Findings: 0 critical, 0 high, 1 medium, 2 low; all were fixed.
3. Deliberately did not rewrite older out-of-scope `.spec_system` Markdown flagged by the global formatter; targeted formatting for the review surface passes.
4. Verification passed for full Vitest, focused Hermes tests, lint, app typecheck, script typecheck, targeted formatter check, whitespace check, and encoding scan.


---

# 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/phase40-session09-model-intelligence-and-pricing/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.
