Kanshō/Code relevance annotation

Code relevance annotation

Inline annotation explaining why a file or span was pulled into the agent's context.

Included in the single kansho full pack. Components are not offered as separate installs.

Reasons

Agent editSession creation refactoredclaude-opus-4-7

Replaced custom HMAC signing with jose SignJWT. Secret now read from env.

    src/auth/session.ts:6–11export async function createSession
    src/auth/jwt.ts:14const secret = getSecret()
Failing testverifySession returns null on tampered tokenvitest

Expected AuthError to be thrown — catch block silently returns null instead.

    src/auth/session.ts:20return null
Search match'verifySession' — 3 matches
    src/auth/middleware.ts:33verifySession(token)
    src/api/routes.ts:78verifySession(req.headers.authorization)
    tests/auth.test.ts:12verifySession('tampered')
Memory referencejose library pinned to v5.2.1

Pinned after v5.3 introduced breaking changes in key import. Do not upgrade without migration.

    src/auth/session.ts:1import { SignJWT, jwtVerify } from 'jose'
LintPrefer const assertion over as const
    src/auth/session.ts:4const SESSION_TTL = 60 * 60 * 24 * 7
Review commentAdd rate limiting before verifySessionAvery
    src/api/routes.ts:78verifySession(req.headers.authorization)

With jump handler

Agent editSession creation refactoredclaude-opus-4-7

Compact — no detail

Search match'verifySession' — 3 matches
    src/auth/middleware.ts:33verifySession(token)
Memory referencejose pinned to v5.2.1
    src/auth/session.ts:1import { SignJWT, jwtVerify } from 'jose'

Component documentation

Code Relevance Annotation

components/sandbox/code-relevance-annotation.tsx

Purpose

Explains why specific file and line ranges matter to an agent task.

Appropriate use

Use beside code inspection when operators need the reason, actor, and referenced locations.

Example

components/sandbox/code-relevance-annotation.tsx has a representative live example in the "With jump handler" section on /components/code-relevance-annotation.

States

Reasons are agent-edit, failing-test, search-match, memory-reference, lint, and review-comment; detail, actor, and jump callback are optional.

API and props

CodeRelevanceAnnotation accepts reason, title, detail, actor, mentions, onJump, and className; each mention supplies path, line, optional endLine, and optional snippet.

Dependencies

Direct imports are React, Lucide icons, InteractiveContainer, and cn.

Accessibility

Each mention exposes visible file and line text; mention rows become keyboard-operable buttons only when onJump is supplied.

Limitations

It does not load files, validate line ranges, navigate without onJump, collapse its always-visible content, or persist state.

Source

Source: components/sandbox/code-relevance-annotation.tsx.

Full pack

components/sandbox/code-relevance-annotation.tsx is documented at /components/code-relevance-annotation and installs only through the single Kansho full pack; no individual component install is offered.