Public Beta
Not set

Experience

Changes how pages explain things, never what you can do.

More

Experience

Changes how pages explain things, never what you can do.

Sign inGet started

Document Assistant v0.3.0 · generic

Archive SHA-256 084f2065dfcd8f2b9402eace1c9e0d03e5eee1dd7d78a54f1dbe7ca5bd99adb2 · 39.1 KB · built Dec 2, 2026

README.md

# Document Assistant (AgentRove native agent)

Offline, deterministic helpers for markdown and plain-text documents you supply: a heading outline, an
extractive summary built only from the document's own sentences, keyword search with line numbers and
context, a line-based comparison of two versions, and (0.3.0) a cited Markdown report built from other agents'
output (`build_report`). No AI model, no network, no API keys.

`build_report` takes a research brief (claims with their source URLs), an optional comparison table in Markdown
(for example from Startup Research), an optional document summary and the source list. Findings are the brief's
claims, word for word, each with numbered citations to its own sources; claims without a source go to "Statements
that need a source" and are never findings. It does not check that a source supports a claim (use Fact Check for
that).

- ID: `agentrove.document-assistant` · version 0.3.0 · MIT
- Published by AgentRove (provisional, configurable name). Package identifiers keep the agentrove prefix for compatibility.
- Runtime: Node.js 20 or newer, no npm dependencies
- Permissions: no filesystem access by tools, no network, no credentials
- External costs: none

## Tools

| Tool | What it does |
| --- | --- |
| `outline` | Headings with level and 1-based line number. Markdown: ATX (`#`…`######`) and setext (`===`/`---` underlines); headings inside fenced code and YAML front matter are ignored. Plain text: numbered lines (`1.`, `1.2`) and ALL-CAPS lines that stand alone between blank lines. Also returns `title` (front-matter `title:`, else first H1, else first heading, else first line) and `word_count`. |
| `summarize` | Extractive summary. Every prose sentence (paragraphs and list items; not headings, code, tables or front matter) is scored as the sum of its distinct terms' weights `tf(term) × ln(1 + N / df(term))` (N = number of paragraphs/list items), heading terms ×1.5, divided by √(sentence length); the document's first sentence gets ×1.15. Sentences are then picked greedily with a redundancy penalty: after a sentence is chosen, its terms count only ×0.3 for the remaining candidates, and each sentence already taken from the same section multiplies a candidate by ×0.8, so the summary covers several sections instead of repeating the dominant topic. Near-duplicate sentences are skipped. Up to `max_sentences` (default 5) are returned verbatim in their original order with line numbers and their unadjusted scores. Output follows the `document_summary` type. |
| `find` | Search for space-separated terms and `"quoted phrases"`. Whole-word and case-insensitive by default (`whole_word`, `case_sensitive`). `mode: "all"` keeps only lines that contain every term. Each match has line, column, matched text, a context snippet (trimmed to whole words) and the enclosing section heading. |
| `compare` | Line diff of `before` vs `after` (Myers algorithm): counts of added / removed / unchanged lines, similarity (`2 × unchanged / (lines_before + lines_after)`), changed regions ("hunks") with 1-based positions and context lines, headings added/removed, and word-count change. For edited lines (a removed line paired with the added line at the same position in a hunk, when at least 40% of their words match), `word_changes` lists the changed words, e.g. `90-day` → `60-day`. `ignore_whitespace` compares lines with runs of whitespace collapsed. |

All tools have `side_effects: "none"`.

Hunk positions follow unified-diff conventions: `before_start` is the first removed line, or, for a
pure insertion, the line after which the new lines go (0 = top of file). The same applies to
`after_start`.

## Typed IO (AgentRove composition)

| Name | Type | Where |
| --- | --- | --- |
| input `text` | `text` (accepts any textual type such as `markdown_document`) | `outline.text`, `summarize.text`, `find.text` |
| output `summary` | `document_summary` | the whole `summarize` result (`{title, outline, key_sentences, word_count, …}`) |

## Usage (Node CLI)

Tools take JSON. To use a file, wrap it into an input file first (only reads the file you name):

```sh
node -e "const fs=require('node:fs');fs.writeFileSync('input.json',JSON.stringify({text:fs.readFileSync(process.argv[1],'utf8'),max_sentences:5}))" notes.md
node bin/cli.js summarize --input input.json
node bin/cli.js outline --input input.json
```

Inline examples (bash; on Windows prefer `--input` files to avoid quoting issues):

```sh
node bin/cli.js find --json '{"text":"Alpha beta.\nBeta gamma.","query":"beta","context_chars":10}'
node bin/cli.js compare --json '{"before":"a\nb\nc","after":"a\nB\nc\nd"}'
node bin/cli.js --help
```

`--input -` reads the input JSON from stdin instead of a file. Output is JSON on stdout; errors are JSON on stderr with exit code 1.

## Use as an MCP server (stdio)

`bin/mcp.js` implements MCP over stdio (`initialize`, `tools/list`, `tools/call`). Register it with an
absolute path, for example in Claude Code:

```sh
claude mcp add document-assistant -- node /absolute/path/to/document-assistant/bin/mcp.js
```

or in a project `.mcp.json`:

```json
{ "mcpServers": { "document-assistant": { "command": "node", "args": ["/absolute/path/to/document-assistant/bin/mcp.js"] } } }
```

`claude-code/SKILL.md` is an optional Claude Code skill that drives the CLI instead.

**Status:** tested with Node.js (unit tests plus MCP message handling). Not yet verified inside Claude
Code by AgentRove.

## Limitations

- Extractive only: it never paraphrases or adds information, so summaries can read choppily and
  pronouns may lose their referent. Scoring favours sentences with frequent, distinctive terms; it
  does not understand meaning.
- Sentence splitting is rule-based (handles common abbreviations such as "e.g.", "Dr.", initials and
  decimals) and is tuned for English and other Latin-script languages; CJK text without spaces is
  not split into sentences or words well.
- Plain-text heading detection is heuristic (numbered or ALL-CAPS lines between blank lines).
- `compare` is line-based: an edit inside a long line shows as one changed line. Very different
  versions (edit distance above 2500 lines) fall back to a coarse "replace the differing middle"
  diff, flagged `approximate: true`.
- `find` columns are JavaScript string offsets (UTF-16), 1-based.
- Limits: 5 M characters per document (2 M per version for `compare`, 100 000 lines), 20 search
  terms, 1000 returned matches.

## Security and privacy

See [SECURITY.md](SECURITY.md). Document text is treated as untrusted data and is never executed
or followed; everything stays on your machine.

## License

MIT, see [LICENSE](LICENSE).

Find an agent

Do not include passwords, keys, customer data or other confidential details.
Rule-based matching is free during the public beta (fair use).