Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ Quickstart; see the [public Host Adapter Matrix](docs/docs/hosts/adapter-matrix.
for their explicit boundaries.

Better Harness scopes behavior claims to relevant Task Episodes and the
surrounding project mechanisms. Qoder produces a Canvas report; Claude Code,
Codex, Cursor, Qwen Code, and GitHub Copilot produce self-contained HTML with
paired Markdown. Missing or partial evidence remains explicit. See the
[Host Adapter Matrix](docs/adapters/README.md) for current coverage and output
differences.
surrounding project mechanisms. Qoder and Cursor produce host-native Canvas
reports; Claude Code, Codex, Qwen Code, and GitHub Copilot produce
self-contained HTML with paired Markdown. Missing or partial evidence remains
explicit. See the [Host Adapter Matrix](docs/adapters/README.md) for current
coverage and output differences.

## See it in action

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
[公开宿主适配矩阵](docs/docs/hosts/adapter-matrix.md)。

Better Harness 会将行为断言限定在相关的任务过程片段(Task Episode)及其周边项目机制内。
Qoder 生成 Canvas 报告;Claude Code、Codex、Cursor、Qwen Code 和 GitHub Copilot 生成自包含的 HTML 报告及配套 Markdown。
Qoder 与 Cursor 生成宿主原生 Canvas 报告;Claude Code、Codex、Qwen Code 和 GitHub Copilot 生成自包含的 HTML 报告及配套 Markdown。
缺失或不完整的证据会被明确标注。有关当前覆盖范围和输出差异,请参阅
[宿主适配器矩阵](docs/adapters/README.md)。

Expand Down
6 changes: 4 additions & 2 deletions docs/adapters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package through the `pi` manifest in `package.json`.
| Claude Code | Analysis-capable source-local host | `.claude-plugin/` | `scripts/agent-customize/providers/claude.mjs` | `scripts/session-analysis/platforms/claude.mjs` | self-contained HTML + Markdown | `.claude` + `CLAUDE.md` + Plugin assets | `claude plugin validate --strict .` -> isolated install/discovery -> configured-asset baseline -> validated `html` render |
| Codex | Analysis-capable source-local host | `.codex-plugin/` | `scripts/agent-customize/providers/codex.mjs` | `scripts/session-analysis/platforms/codex.mjs` | self-contained HTML + Markdown | `.codex` + `.agents` + `AGENTS.md` | `harness prepare --platform codex` -> finalize with `html-report` validation |
| Qoder | First-class product host | `.qoder-plugin/` | `scripts/agent-customize/providers/qoder.mjs` | `scripts/session-analysis/platforms/qoder.mjs` | `better-harness` | `.qoder/rules` + `AGENTS.md` + output templates | `better-harness harness render --mode qoder-canvas --validate` |
| Cursor | Analysis-capable source-local host | `.cursor-plugin/` | `scripts/agent-customize/providers/cursor.mjs` | `scripts/session-analysis/platforms/cursor.mjs` | self-contained HTML + Markdown | `.cursor` + `.codex` compatibility + `AGENTS.md` | `agent --plugin-dir . --mode ask --print` -> Cursor evidence bundle -> validated `html` render |
| Cursor | Canvas-capable source-local host | `.cursor-plugin/` | `scripts/agent-customize/providers/cursor.mjs` | `scripts/session-analysis/platforms/cursor.mjs` | `cursor-canvas` | `.cursor` + `.codex` compatibility + `AGENTS.md` | `agent --plugin-dir . --mode ask --print` -> Cursor evidence bundle -> validated `cursor-canvas` render |
| Qwen Code | Analysis-capable source-local host | `qwen-extension.json` | `scripts/agent-customize/providers/qwen.mjs` | `scripts/session-analysis/platforms/qwen.mjs` | self-contained HTML + Markdown | `.qwen` + `QWEN.md` + `AGENTS.md` | `harness prepare --platform qwen` -> finalize with `html-report` validation |
| GitHub Copilot | Analysis-capable source-local host | `.github/plugin/` | `scripts/agent-customize/providers/copilot.mjs` | `scripts/session-analysis/platforms/copilot.mjs` | self-contained HTML + Markdown | `.github` + `AGENTS.md` + `~/.copilot` | `copilot plugin marketplace add .` -> `copilot plugin install better-harness@better-harness` -> configured-asset baseline -> validated `html` render |
| Pi | Analysis-capable source-local host | `pi` manifest in `package.json` | `scripts/agent-customize/providers/pi.mjs` | `scripts/session-analysis/platforms/pi.mjs` | self-contained HTML + Markdown | `.pi` + `.agents` + `AGENTS.md` | `pi install <source>` or `pi -e <source>` -> `/better-harness` prompt template -> validated `html` render |
Expand Down Expand Up @@ -116,7 +116,9 @@ Canonical templates live under `templates/reporting/`.

- `qoder-canvas.md`: Qoder Canvas output contract, covering renderer-owned
`findings.json`, Canvas-only `canvas.json`, and `report.canvas.tsx`.
- `html-visual.md`: portable Claude Code/Codex/Cursor/Qwen/Copilot/Pi/WorkBuddy visual output contract, covering
- `cursor-canvas.md`: Cursor Canvas output contract, covering the complete
report, native Context Usage projection, and public IDE actions.
- `html-visual.md`: portable Claude Code/Codex/Qwen/Copilot/Pi/WorkBuddy visual output contract, covering
`findings.json`, `report.md`, and `report.html`.
- Markdown-only output has no visual companion.

Expand Down
1 change: 1 addition & 0 deletions docs/adrs/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ templates/ # [active] runtime-selected contracts
routing.md # [active] report/style/output route selection
report-structure.md # [active] Markdown report skeleton
qoder-canvas.md # [active] Qoder Canvas output contract
cursor-canvas.md # [active] Cursor Canvas output contract
html-visual.md # [active] HTML visual contract
style/ # visual grammar and style routing
components/ # [target] reusable component profiles, 2+ consumers
Expand Down
6 changes: 4 additions & 2 deletions docs/docs/hosts/adapter-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ remains the complete capability-level source of truth.
| Qoder | Verified Quickstart | First-class product host | `.qoder-plugin/` | Qoder sessions | Qoder Canvas report |
| Claude Code | Verified Quickstart | Analysis-capable source-local host | `.claude-plugin/` | Workspace-matching local Claude transcripts when present | Self-contained HTML + Markdown |
| Codex | Verified Quickstart | Analysis-capable source-local host | `.codex-plugin/` | Codex sessions | Self-contained HTML + Markdown |
| Cursor | Verified Quickstart | Analysis-capable source-local host | `.cursor-plugin/` | Workspace-matched transcripts, metadata, and audit logs; partial coverage stays explicit | Self-contained HTML + Markdown |
| Cursor | Verified Quickstart | Canvas-capable source-local host | `.cursor-plugin/` | Workspace-matched transcripts, metadata, audit logs, and optional native Context Usage snapshots; partial coverage stays explicit | Cursor Canvas report |
| Qwen Code | Verified Quickstart | Analysis-capable source-local host | `qwen-extension.json` | Workspace-matching local Qwen transcripts when present | Self-contained HTML + Markdown |
| GitHub Copilot | Verified Quickstart | Analysis-capable source-local host | `.github/plugin/` | Workspace-matched Copilot CLI transcripts; partial coverage stays explicit | Self-contained HTML + Markdown |
| Pi | Adapter support | Analysis-capable source-local host | `pi` manifest in `package.json` | Workspace-matching local Pi sessions | Self-contained HTML + Markdown |
Expand All @@ -42,7 +42,9 @@ source-local.

- **Qoder Canvas** — renderer-owned `findings.json`, Canvas-only
`canvas.json`, and `report.canvas.tsx`.
- **HTML visual** — portable Claude Code/Codex/Cursor/Qwen/Copilot/Pi/WorkBuddy contract
- **Cursor Canvas** — the same complete report contract rendered with
`cursor/canvas`, native Context Window evidence, and IDE actions.
- **HTML visual** — portable Claude Code/Codex/Qwen/Copilot/Pi/WorkBuddy contract
covering `findings.json`, `report.md`, and a self-contained `report.html`
(see the [sample report](pathname:///demo/better-harness-report/)).
- **Markdown-only** — no visual companion.
Expand Down
7 changes: 4 additions & 3 deletions docs/docs/your-first-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ your host's **Verify installation** section—the syntax is host-specific:
does not claim an unverified slash-command alias.

Better Harness scopes behavior claims to relevant Task Episodes and the
surrounding project mechanisms. Qoder produces a Canvas report; Claude Code,
Codex, Cursor, Qwen Code, and GitHub Copilot produce self-contained HTML with
paired Markdown. Missing or partial evidence remains explicit.
surrounding project mechanisms. Qoder and Cursor produce host-native Canvas
reports; Claude Code, Codex, Qwen Code, and GitHub Copilot produce
self-contained HTML with paired Markdown. Missing or partial evidence remains
explicit.

See the [sample report](pathname:///demo/better-harness-report/) for
what the HTML output looks like.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Better Harness 当前声明了八个能力层宿主适配器,其中六个已
| Qoder | 已验证快速开始 | 一等产品宿主 | `.qoder-plugin/` | Qoder 会话 | Qoder Canvas 报告 |
| Claude Code | 已验证快速开始 | 具备分析能力的源码本地宿主 | `.claude-plugin/` | 匹配当前工作区的本地 Claude 转录(存在时) | 自包含 HTML + Markdown |
| Codex | 已验证快速开始 | 具备分析能力的源码本地宿主 | `.codex-plugin/` | Codex 会话 | 自包含 HTML + Markdown |
| Cursor | 已验证快速开始 | 具备分析能力的源码本地宿主 | `.cursor-plugin/` | 工作区匹配的转录、元数据和审计日志;部分覆盖保持显式标注 | 自包含 HTML + Markdown |
| Cursor | 已验证快速开始 | 支持 Canvas 的源码本地宿主 | `.cursor-plugin/` | 工作区匹配的转录、元数据、审计日志和可选原生 Context Usage 快照;部分覆盖保持显式标注 | Cursor Canvas 报告 |
| Qwen Code | 已验证快速开始 | 具备分析能力的源码本地宿主 | `qwen-extension.json` | 匹配当前工作区的本地 Qwen 转录(存在时) | 自包含 HTML + Markdown |
| GitHub Copilot | 已验证快速开始 | 具备分析能力的源码本地宿主 | `.github/plugin/` | 工作区匹配的 Copilot CLI 转录;部分覆盖保持显式标注 | 自包含 HTML + Markdown |
| Pi | 适配器支持 | 具备分析能力的源码本地宿主 | `package.json` 中的 `pi` manifest | 匹配当前工作区的本地 Pi 会话 | 自包含 HTML + Markdown |
Expand All @@ -38,7 +38,9 @@ Better Harness 当前声明了八个能力层宿主适配器,其中六个已

- **Qoder Canvas** —— 渲染器负责的 `findings.json`、仅 Canvas 使用的
`canvas.json` 和 `report.canvas.tsx`。
- **HTML 可视化** —— 面向 Claude Code/Codex/Cursor/Qwen/Copilot/Pi/WorkBuddy 的可移植契约,覆盖
- **Cursor Canvas** —— 使用 `cursor/canvas`、原生 Context Window 证据和
IDE actions 渲染同一份完整报告契约。
- **HTML 可视化** —— 面向 Claude Code/Codex/Qwen/Copilot/Pi/WorkBuddy 的可移植契约,覆盖
`findings.json`、`report.md` 和自包含的 `report.html`
(见[示例报告](pathname:///demo/better-harness-report/))。
- **纯 Markdown** —— 无视觉版本。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ sidebar_position: 3
再让 Copilot 使用该 Skill 完成分析。本站不会声称未经验证的斜杠命令别名。

Better Harness 会把行为论断限定在相关的 Task Episode 和周边的项目机制内。
Qoder 产出 Canvas 报告;Claude Code、Codex、Cursor、Qwen Code 和 GitHub Copilot
产出自包含 HTML 并配套 Markdown。缺失或不完整的证据保持显式标注。
Qoder 与 Cursor 产出宿主原生 Canvas 报告;Claude Code、Codex、Qwen Code 和
GitHub Copilot 产出自包含 HTML 并配套 Markdown。缺失或不完整的证据保持显式标注。

想了解 HTML 输出的样子,可以查看
[示例报告](pathname:///demo/better-harness-report/)。
Expand Down
121 changes: 121 additions & 0 deletions docs/specs/2026-08-01-cursor-canvas-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Render complete Better Harness reports in Cursor Canvas

## Traceability

- Spec ID: `cursor-canvas-report`
- Status: Implemented

## Intent

Give Cursor users the same durable, complete Better Harness report experience
that Qoder users receive, while using Cursor's public Canvas SDK and native IDE
actions. Cursor session scans should automatically retain any workspace-scoped
Context Usage snapshot that Cursor has already materialized, and the report
renderer should present that evidence as one section of the full report rather
than as a standalone Context Usage page.

The existing Qoder Canvas, Markdown, and HTML routes remain unchanged. JSON
analysis remains parser-safe and does not acquire an implicit file-write side
effect.

## Acceptance Scenarios

- AC-1: A Cursor session analysis for a workspace discovers existing native
`context-usage-*.canvas.data.json` snapshots only below that workspace's
Cursor project directory. It projects bounded token/category/item metadata,
omits raw item text, and reports missing snapshots as unobserved rather than
as zero usage.
- AC-2: `harness analyze --platform cursor --format json` includes the bounded
Context Usage projection in its exact summary facts when observed, without
changing Qoder, Markdown, or HTML behavior and without writing files unless
an explicit output option is supplied.
- AC-3: `harness render --mode cursor-canvas` accepts the same complete reviewed
`summary + findings` contract as Qoder Canvas and writes a deterministic
`findings.json`, `canvas.json`, and `report.canvas.tsx` bundle.
- AC-4: The generated Cursor Canvas renders the complete Better Harness reader
flow: introduction and Fluency dimensions, project usage, AI Agent Practice,
Context Window, prioritized findings, suggestions, and evidence/methodology.
Context Window remains visible as unavailable when no native snapshot exists.
- AC-5: The Canvas uses only the public `cursor/canvas` surface. Finding handoff
dispatches `newComposerChat`, safe file-backed evidence dispatches `openFile`
with an optional selection, and an observed source conversation dispatches
`openAgent`. Action payloads are transport data and raw session ids are not
printed as reader copy.
- AC-6: Render-time validation proves the final TSX parses as TSX, imports only
the public `cursor/canvas` surface, contains the complete report
sections, and binds the public Canvas actions. Validation does not depend on
Qoder's runtime declarations.
- AC-7: A bounded real-workspace smoke completes the Cursor scan and then
produces a validated `cursor-canvas` bundle from the resulting report data.
The generated TSX can be transformed successfully with the repository's
shipped TSX transform.

## Non-goals

- Reproduce Cursor's proprietary Context Usage implementation or copy its
generated template.
- Decode Cursor `store.db`, synthesize missing system/tool definitions, or claim
token attribution that Cursor did not materialize.
- Make Canvas generation a side effect of every JSON command.
- Refactor the existing Qoder Canvas template in the same change.
- Add comprehensive unit coverage before the first end-to-end render smoke;
focused contract tests may follow once the runnable path is proven.

## Plan and Tasks

1. Extend the Cursor session provider with an optional, workspace-qualified
native Context Usage source and a privacy-bounded projection.
2. Thread Context Usage through the task-loop source, summary-facts projection,
complete report contract, and Canvas split/merge path.
3. Add the `cursor-canvas` renderer and a standalone Cursor SDK template that
embeds the merged complete report while retaining the sibling JSON artifacts
as the durable data contract.
4. Add Cursor-specific validation using the existing module-boundary scanner
and TSX transform, then register the mode in report routing and CLI help.
5. Run a real Cursor scan followed by a complete report projection/render and
inspect the generated artifacts and transformed module.

The Cursor renderer remains capability-owned under `scripts/harness-analysis/`
and the template remains under `templates/canvas/`; the `.cursor-plugin` shell
does not own report judgment or schema.

## Test and Review Evidence

- AC-1/AC-2: Run `node scripts/session-analysis.mjs insights --platform cursor
--workspace <workspace> --format json` and `node scripts/better-harness.mjs
harness analyze --platform cursor --workspace <workspace> --format json`.
Inspect the bounded projection and confirm no raw item `text` is retained.
- AC-3/AC-4/AC-5: Render a complete Agent Work Loop report with `--mode
cursor-canvas`; inspect all three artifacts and the generated action bindings.
- AC-6: Run the Cursor Canvas validator against the final run directory and
transform `report.canvas.tsx` with `transformCanvasSource`.
- AC-7: Use a temporary run directory for the real scan/render smoke and retain
the command output plus artifact inventory as review evidence.
- Risk: Cursor's native snapshot schema and public Canvas SDK may change. Fail
closed on malformed snapshots, retain an explicit schema/status boundary,
and avoid private command ids or internal protobuf imports.
- Risk: native snapshot items may contain raw prompt or tool text. Persist only
labels, token/character counts, hierarchy, and safe file references; never
copy the native `text` field into analysis or report artifacts.
- Risk: Cursor actions can expose local identity or files. Keep ids as hidden
action transport, render safe paths only when already admitted by the report,
and omit unavailable actions instead of inventing targets.

## Implementation Evidence

- AC-1/AC-2: Real Cursor scans covered both an observed native snapshot
(`56,860 / 300,000`, seven categories, 119 bounded items) and the explicit
unobserved Better Harness workspace state; projected items retained no raw
`text` and did not print absolute labels.
- AC-3/AC-4/AC-5/AC-6: `harness render --mode cursor-canvas --validate` wrote
exactly `findings.json`, `canvas.json`, and `report.canvas.tsx`; validation
passed data, module-boundary, complete-section, action-binding, and TSX
transform checks with `cursor/canvas` as the sole import.
- AC-7: Cursor 3.13.10 opened the generated managed Canvas and rendered the
overview, strengths, Fluency chart, AI Agent Practice, Context Window,
findings boundary, and evidence/methodology sections. The unavailable Context
Window state remained explicit for the Better Harness workspace.
- Repository verification: `npm test` passed 1,051 tests, `npm run pack:verify`
passed both npm and runtime ZIP inventories, the generated doc-link graph was
current, and the local preview returned `ok` from `/health` plus a transformed
`/canvas-module.js`.
4 changes: 2 additions & 2 deletions scripts/better-harness-cli/registry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const COMMANDS = [
audience: "workflow",
script: "harness-analysis/report-run.mjs",
summary: "Return a neutral, budgeted Harness evidence brief.",
description: "Scan evidence read-only and return bounded natural text for AI interpretation, plus exact report summary facts in JSON mode; explicit Qoder canvas-out initializes them and replace-canvas refreshes only that authorized path.",
description: "Scan evidence read-only and return bounded natural text for AI interpretation, plus exact report summary facts in JSON mode; explicit Qoder or Cursor canvas-out initializes them and replace-canvas refreshes only that authorized path.",
},
{
name: "checkup",
Expand Down Expand Up @@ -216,7 +216,7 @@ const COMMANDS = [
audience: "advanced",
script: "harness-analysis/render-report.mjs",
summary: "Render reviewed findings data into report artifacts.",
description: "Render reviewed findings.json data into qoder-canvas, markdown, or html, and optionally run the selected validators.",
description: "Render reviewed findings.json data into qoder-canvas, cursor-canvas, markdown, or html, and optionally run the selected validators.",
},
{
name: "preview-canvas",
Expand Down
Loading