TypeScript · JavaScript · LLM tools
Two libraries for text review.
Rules and review prompts for your agent. Annotations and text selection for your website. Use either package independently.
Tooling · @voice/writing-rules
Prepare a text review
20 rules with examples and exceptions, four review profiles, composable prompts and local phrase checks. Four LLM tools expose these capabilities to an agent workflow.
Tool calls and example ↗HTML · @voice/review
Show findings on the page
Mark findings on their text, preserve native selection, and return the quote and source position to your application. Your application presents and saves decisions and alternatives.
Try the HTML library ↗Use Voice as an LLM tool
Your application registers the tool schemas with its model and passes returned calls to the dispatcher. It supplies the audience and writing goal. The dispatcher returns rule knowledge, a review prompt or local signals.
import {
createWritingToolDispatcher,
writingReviewTools,
} from '@voice/writing-rules/tools';
const dispatcher = createWritingToolDispatcher({
reviewContext: {
audience: 'Developers reading the setup guide',
goal: 'Open a folder and complete a review',
},
});
// Register these schemas in your model's tool format.
const definitions = writingReviewTools;
// Dispatch a decoded tool call from your agent.
const result = await dispatcher.dispatch({
name: 'compose_writing_review_prompt',
arguments: { profile: 'public-docs', language: 'en' },
});This example runs locally. Your application executes model requests and validates responses. The ESM packages include TypeScript declarations; build them in the workspace. They are not yet published to npm.
Tool schemas, results and complete examples ↗
Review prompts and model comparisons
Choose a review profile and, when needed, individual rules. Its prompt includes concrete instructions, conditional examples and cases where the text should stay. It includes the audience and writing goal in the review instructions.
Your application can connect retained benchmark results for its available models. The get_model_comparison_evidence tool can return either or both comparisons when supported by evidence: the least expensive option meeting your quality requirements, and the highest observed issue detection. Language, review profile and test cohort must match; false changes, evidence sources and limitations accompany the result.
No qualified model comparison is currently available. Without matching evidence, the tool returns evidence-missing. The library does not compute a ranking; the benchmark evaluator assesses retained responses and independent human judgments.
Quality criteria, file tree and reproducible evaluation ↗ · Research, rules and static analysis ↗
Try the HTML library
The example below uses the shipped browser bundle. The underline is a supplied example finding, not an analyzer verdict. Select text to inspect its exact quote and UTF-16 span. Nothing is saved or sent to a model.
What the package does
mountVoiceReview draws supplied findings and feedback using text-range geometry. It preserves native selection and page interaction. Explicit unit IDs and exact text matches prevent ambiguous anchors from silently pointing elsewhere. Hosts supply an accessible findings list and persistence callbacks.
import { mountVoiceReview, type TextUnit }
from '@voice/review';
export function review(root: HTMLElement) {
const text = 'Clear copy.';
root.textContent = text;
root.dataset.voiceUnit = 'intro';
const unit: TextUnit = {
id: 'intro', text, kind: 'paragraph', language: 'en',
sourceSpan: { start: 0, end: text.length, encoding: 'utf16' }
};
const controller = mountVoiceReview({
root, units: [unit], findings: [], feedback: [],
onSelect: selection => console.info(selection.quote)
});
return () => controller.dispose();
}Consume the built ESM package in a workspace or copy voice-review.js to local assets. It has no Angular runtime dependency and is not published to npm.
TypeScript and JavaScript IntelliSense
The public ESM entry ships declarations and JSDoc. Editors using TypeScript’s language service can complete update, selectFinding, getDiagnostics and dispose; selection callbacks infer unitId, quote, start and end. Plain JavaScript uses // @ts-check and JSDoc type imports. The standalone browser global also has a type-only reference.
The tests compile isolated consumers against the distributed declarations and verify actual language-service completions and hover text. They do not automate the VS Code interface.
Copy typed examples and inspect the contract
Connect your AI or agent workflow
Your host runs the analysis and validates its output. Convert code-point offsets to UTF-16, check unit identity and the exact quote, and retain the source version before supplying findings. The Library renders those findings; your backend owns credentials, durable decisions, proposals and source writes. The live bridge only exchanges review messages with its configured Studio parent or opener.
Agent integration and result boundaries · Studio’s Runner adapter
Compose your review rules
@voice/writing-rules supplies a versioned rule catalogue, review profiles and prompt composition. Local surface checks return candidate passages for human review. Your host runs any model analysis and validates the returned findings.
Explore the patterns and prompts · Use the writing-rules package
Full library integration guide · Live bridge protocol · Docs