@nsolland/the-thread
v0.5.26
Published
The Thread: continuous agent memory, context and work across machines; Varde remains a compatible command.
Readme
Varde
Product boundary: Varde is independent of Jackets. It neither requires nor integrates with Jackets, and its setup, agent hooks and runtime must never start or enable Jackets. The rule is enforced by test/no-jackets-boundary.test.js and maintained in AGENTS.md.
Varde is the persistent task bridge and execution coordinator for AI coding agents. It connects modern AI agents (Claude Desktop, Cursor, Hermes Agent) to Dyade episodic memory and World Commander distributed execution workers with verifiable audit receipts.
Zero external dependencies (node:crypto, node:child_process, node:fs). Runs on Node.js >= 18.
Install once
npx @nsolland/varde setupOne command installs a stable runtime, a built-in memory store (no Python/Dyade needed), MCP for every detected client, automatic capture + session-start context hooks for Claude Code and Codex, and a background sync that recovers crashed sessions. Then: varde recall <query>, varde context, varde status, varde uninstall. Exactly what is and is not automatic per client (ChatGPT/claude.ai are not): docs/AUTOMATIC_CONTINUITY_V1.md.
JUST YOU / capture-first contract: Varde accepts raw text, arbitrary JSON values and binary content without requiring senders to supply Dyade event fields or a taxonomy. Use varde capture 'anything at all', cat raw.txt | varde capture, varde capture --file raw.bin, or the varde_capture MCP tool ({ "content": <any JSON value> }, or plain arbitrary arguments). Original UTF-8 text is preserved verbatim; structured values are serialized as JSON; non-UTF-8 binary is preserved as base64. Varde creates an internal envelope and SHA-256 digest, chunks larger inputs and verifies all stored chunks by exact read-back. The result is explicitly PERSISTED or QUEUED. Normalization follows later and never replaces the raw evidence. Capture currently has a 1 MiB per-input bound and a 16 MiB private retry queue in the existing Dyade home; no repository copies are created. The queue has mode 0700; files 0600. Retries can be run with varde capture replay; Linux systemd timer templates are in integrations/systemd/. This is an observation-only path, never an execution permit. Physical-AI transferability: ADAPTER_PATH via opaque binary observations; no physical-device live test is claimed.
Core Capabilities
Cross-Session Agent Continuity
- Retains goals, task IDs, progress notes, and execution history across independent agent sessions, IDE reloads, or process restarts.
- Preserves state strictly inside Dyade event memory without requiring an external task database.
Automated MCP Client Onboarding
- One-command setup:
varde setupautomatically discovers and configures desktop AI clients (Claude Desktop, Cursor, Hermes Agent). - Instant Model Context Protocol (MCP) server over stdio via
varde-mcp.
- One-command setup:
Customer Security Policy Engine (
varde policy)- Operator Mode (Default): Full, unconfined execution for internal operators across connected hosts.
- Restricted Sandbox Mode: Confines external agent work to designated repository roots (
--allow <path>), blocks sensitive system directories (/etc,/boot,/sys,/proc,/root, credentials), blocks destructive command patterns (rm -rf /,chmod 777 /), and forbids unauthorized privilege escalation (sudo,su). - Audit Mode: Monitors and flags command violations without terminating execution.
Veritas Cryptographic Execution Receipts
- Every World Commander action produces a verifiable, tamper-evident cryptographic receipt:
- Unique receipt ID (
vr_<hex>) - SHA-256 digest of executed command
- SHA-256 digest of standard output/error
- Timestamp, exit code, worker identifier, and active security policy mode.
- Unique receipt ID (
- Every World Commander action produces a verifiable, tamper-evident cryptographic receipt:
Quickstart
1. Quick Onboarding (Zero-Install)
Run the interactive setup wizard directly without installing:
npx @nsolland/varde setup2. Global Installation
npm install --global @nsolland/vardeOr via one-liner installer (Linux & macOS):
curl -fsSL https://raw.githubusercontent.com/nsolland/varde/main/scripts/install.sh | bash2. Automated Setup Wizard
# Discovers local Dyade, World Commander, and desktop AI clients, then auto-configures MCP
varde setupTo preview without modifying client config files:
varde setup --dry-run3. Check System Health
varde doctor
varde statusCLI Reference
Client & MCP Management
varde setup # Interactive onboarding wizard
varde mcp # Launch MCP server over stdio
varde mcp clients # List detected AI clients & configuration status
varde mcp install --client <c> # Configure Claude, Cursor, or Hermes
varde mcp uninstall --client <c> # Remove Varde from a client configurationTask Continuity & Execution
varde task start "Implement feature X" # Returns task ID (e.g. vt0123...)
varde task resume <task-id> # Retrieve goal, history, and notes
varde task note <task-id> "Progress note" # Append handoff or context note
varde task link <task-id> <session-id> # Bind an agent session ID (e.g. Hermes)
varde task session <task-id> # Retrieve bound agent session ID
varde task run <task-id> --worker <name> --repo <abs-path> --owner <claim-owner> -- <command...>
varde decision record '<json>' # Store one evidence-anchored model observation
varde decision compare '<json>' # Compare all models for a task/question pairUniversal agent memory (MCP)
All configured MCP clients can call four simple tools:
varde_remember({type, content, task_id?})stores a source-linked statement in Dyade. The statement is alwaysUNVERIFIEDuntil independently substantiated; task linkage proves provenance, not truth.varde_recall({memory_id?, task_id?, query?, limit?})returns scoped memory statements and append-only corrections.varde_resume({task_id})reconstructs task goal and memory history, including corrections and retractions.varde_correct({memory_id, reason, action: "correct"|"retract", content?})appends a correction without rewriting the original event.varde_discover({limit?, types?, known_connections?})performs queryless, bounded scans of recent scoped Dyade session indexes to identify possible cross-session connections, recurring concepts and opportunity hypotheses. Contradiction and evidence-gap classification are explicitly not yet supported; no full-corpus claim.
These tools do not authorize execution or replace the strict varde_decision_record contract. Retrieval is bounded to the configured Dyade owner/projects and fails on truncated scoped queries. Restart the MCP client after installing a release that includes these tools.
Manual ChatGPT session capture (Varde)
In a ChatGPT conversation, type "Varde capture" when a Varde-capable assistant or
the connected machine tool is available. The assistant summarizes only the
conversation context visible to it (topic, goals, decisions, findings, open
questions, tasks and next actions), invokes varde_chatgpt_capture, and
returns the verified Dyade capture_id. This is not a native ChatGPT
lifecycle hook or access to hidden/other sessions.
For CLI-only clients, provide the same summary as a local JSON file:
varde chatgpt capture --file /path/visible-session-summary.json
varde chatgpt get vgc_<40-hex-digits>
varde chatgpt find VardeMCP equivalents: varde_chatgpt_capture({title,summary,goals?,decisions?,findings?,
open_questions?,open_tasks?,next_actions?,limitations?,source_session_id?,source_url?,source_refs?}),
varde_chatgpt_get({capture_id}), and varde_chatgpt_find({query}).
A successful capture requires a Dyade write and independent exact readback; identical
summaries are deduplicated by content digest. Returned context is always
PARTIAL_VISIBLE_CONTEXT / UNVERIFIED_SUMMARY; source references are
identifiers, not evidence authentication. This stays fully separate from
optional ChatGPT ZIP export ingestion and does not involve Jackets.
Security Policy
varde policy show # View active mode and path constraints
varde policy set --mode restricted --allow /path/to/project
varde policy reset # Reset to internal operator modeMemory & World Commander
varde snapshots [--limit 10] # View rolling 5-minute session snapshots
varde search "<query>" # Query Dyade event memory
varde world status # Check World Commander nodes
varde world workers # List authorized execution workersThe Thread investigation
varde thread investigate "Synapse" \\
--source-dir /path/to/authorized-exports \\
--db /path/to/thread.sqlite \\
--tenant personal --project synapse \\
--manifest /path/to/source-manifest.json
varde thread scout run --source-dir /path/to/authorized-exports \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite \\
--tenant personal --project synapse
varde thread scout status --registry /path/to/thread-source-registry.jsonl
# Force rebuilding the derived index from the authorized export directory.
varde thread scout run --force --source-dir /path/to/authorized-exports \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite --tenant personal --project synapse
# Explicitly revoke an indexed source key (never inferred from a missing local file).
varde thread scout revoke --source-key ts_<40-hex> \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite --tenant personal --project synapse
# Explicit restore still requires a fresh authorized source re-read.
varde thread scout restore --source-key ts_<40-hex> \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite --tenant personal --project synapse
varde thread scout run --force --source-dir /path/to/authorized-exports \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite --tenant personal --project synapse
varde thread scout reconcile --source-dir /path/to/authorized-exports \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite --tenant personal --project synapse
# Continuous polling; omit --cycles for a long-running Scout service
varde thread scout daemon --source-dir /path/to/authorized-exports \\
--registry /path/to/thread-source-registry.jsonl \\
--db /path/to/thread.sqlite --tenant personal --project synapse \\
--interval-ms 60000 --cycles 1
# Inspect a superseded source event by exact ID (unverified unless --verify archive configured).
varde thread history --event-id te_<40-hex> --db /path/to/thread.sqlite \\
--tenant personal --project synapse
varde thread critique --file /path/to/investigation-report.json
varde thread evaluate plan --file /path/to/state-evaluation-plan.json
varde thread evaluate tax --file /path/to/memory-tax-input.jsonThe investigation command discovers only explicitly supplied exports, records source and
time coverage, verifies retrieved events against those original files, and returns a
source-anchored report. Without a manifest, global completeness remains UNKNOWN by
design. Missing sources, unsupported files, unverified events and token-budget omissions
are reported as knowledge gaps. Retrieval and analysis never modify Dyade evidence.
Adaptive retrieval and persistent knowledge gaps
varde thread adaptive "Compare run A and run B" \
--source-dir /path/to/authorized-exports --db /path/to/thread.sqlite \
--tenant personal --project synapse
varde thread gaps --db /path/to/thread.sqlite --tenant personal --project synapsevarde_thread_adaptive and varde_thread_gaps expose the same operations over MCP
with scoped data objects. Adaptive retrieval reuses the existing FTS5/optional semantic
index and independently verifies indexed hits against the explicitly supplied originals.
It runs a bounded query/source loop, retains a source-and-verification trace, and stores
open knowledge gaps in <db>.gaps.jsonl. This JSONL file is an operational worklist,
not Dyade evidence or permission. The --ledger option selects another path.
No provider-wide collection is implied.
The default CLI uses deterministic single-query retrieval. Host applications can inject
planner, grader, synthesizer and source_adapters callbacks for multi-hop,
query reformulation, corrective search and answer synthesis; model claims require citations
to independently verified event IDs. Without an assessment adapter, even verified evidence
is reported as PARTIAL_VERIFIED_EVIDENCE, never as a proven complete answer.
Query/call/time bounds are configurable (--max-queries, --max-calls, --timeout-ms,
--max-elapsed-ms). Each run has a 30-second total budget by default.
For actual model-driven adaptive retrieval, explicitly select an OpenAI-compatible chat-completions endpoint and model (including local models):
VARDE_ADAPTIVE_ENDPOINT=http://127.0.0.1:1234/v1 \
varde thread adaptive "Compare run A and run B" \
--source-dir /path/to/authorized-exports --db /path/to/thread.sqlite \
--tenant personal --project synapse --model local-modelRemote model services must use HTTPS; set VARDE_ADAPTIVE_TOKEN in the host
environment, never in the command line. An existing OPENAI_API_KEY is used
only when the explicit endpoint is api.openai.com, never for another provider.
The explicit --model switch may transmit retrieved original text to the endpoint;
without it no model request occurs. Model-generated grades are assessments, not
independent proof of factual correctness. Other apps may supply their own adapters.
PAT-1: ADAPTER_PATH. The neutral contract is question, scoped original-backed
observations, event/recording times, bounded plans, evaluation and gap work objects.
Adapters can use documents, telemetry or simulated embodied observations without
changing that contract. Current implementation is non-real-time and not qualified
for physical control. Next transfer test: replay captured, independently checked
sensor observations across process/device restarts; hardware latency and sim-to-real
behavior remain unverified. A non-AI index search remains the cheaper choice for
simple queries.
The Scout registry is an operational, append-only JSONL projection. It records jobs,
source coverage, time ranges, digest changes and lifecycle states (DISCOVERED,
CONNECTED, SYNCED, VERIFIED, INDEXED, RETRIEVABLE, plus STALE, PARTIAL,
BLOCKED, REVOKED and retryable failures). A changed source becomes STALE before
it can be trusted again. Unchanged exports are skipped on subsequent polls. Each
provider object has a stable source_key and content-derived revision_id;
only the latest active revision is returned by default from FTS, vectors or
JANUS expansion. Missing or unreadable local exports are suspended from active
retrieval until successfully reimported, without interpreting their absence as
a provider-side deletion. Explicit source revocation remains fail-closed.
Gmail and web are supported as supplied structured JSON exports, not
live authenticated account connectors. The critical review layer is separate from evidence: it runs
red-team checks, tracks verification debt and produces a Leif-adjusted assessment;
it may downgrade a conclusion but never rewrites the Dyade record.
State evaluation is explicit and separate from Dyade evidence. State envelopes carry
evidence, representation, access, trust and coverage independently. The evaluation
contract requires matched RAW_HISTORY, ORACLE_EVIDENCE, COMPILED_LOCAL_STATE,
ACCESS_STATE_ONLY, STATE_TRANSFER and READ_BUDGET_INBOX arms. Memory-tax reports
separate construction loss from access loss and total cost. Inbox reads are budgeted
and record delivered versus actually read material; unread material is never silently
treated as covered. State transfer is digest-bound and fails closed on mismatch.
Matched runners also reject any arm whose case ID, observation digest or read/compute
budget differs from the frozen holdout case. This prevents a cheaper or better-looking
arm from silently receiving a different information set.
Model Context Protocol (MCP) Tools
When configured in Claude Desktop, Cursor, or Hermes, Varde exposes task, continuity and decision-memory MCP tools, including:
| Tool | Purpose |
|------|---------|
| varde_status | Unified health across Dyade, World Commander, and active security policy. |
| varde_task_start | Initialize a persistent task with a goal. |
| varde_task_resume | Recover task state, history, and notes from Dyade. |
| varde_task_note | Append context or handoff notes across agent steps. |
| varde_task_link | Bind agent session IDs (e.g. Hermes) to a Varde task. |
| varde_task_run | Execute commands via World Commander with security policy enforcement. |
| varde_policy_status | Inspect active security policy rules and confinement boundaries. |
| varde_decision_record | Store a model conclusion, its cited rationale, actions, documented non-actions and gap hypotheses in Dyade. |
| varde_decision_compare | Compare model positions, input context, action states, missing coverage and candidate collective blind spots. |
Remote clients (claude.ai, ChatGPT): HTTP transport
varde-mcp speaks stdio for Claude Desktop. Remote connectors need HTTP:
VARDE_MCP_TOKEN_FILE=~/.config/varde/mcp.token varde-mcp --http --port 8796It binds to 127.0.0.1 only, requires Authorization: Bearer <token> from a
private (0600) file of at least 32 characters, and serves the same tool catalog
as stdio (varde_task_run, varde_task_*, varde_thread_*, memory). Publish it
only through the existing authenticated public proxy (/varde/mcp in
world-commander/world_public_proxy.py), which validates Cloudflare Access and
injects this credential. The connector then gets World Commander execution and
The Thread through one Varde entry.
Decision & Omission Memory
varde decision record '<json>' stores an append-only observation in Dyade. The same operations are available as varde_decision_record and varde_decision_compare over MCP.
Example input for one agent:
{
"task_id": "TraXin",
"question_id": "stripe-partnership",
"session_id": "session-123",
"source": "chatgpt",
"model": "gpt-6",
"observed_at": "2026-10-29T08:00:00Z",
"input_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"coverage": "PARTIAL",
"stance": "CONDITIONAL",
"conclusion": "Evaluate partnership before forming a company.",
"source_event_ids": ["original-event-123"],
"rationale": [
{
"text": "The source discusses risk transfer.",
"basis": "MODEL_STATED",
"evidence_event_ids": ["original-event-123"]
}
],
"actions": [
{
"action": "Contact Stripe",
"state": "NOT_OBSERVED",
"evidence_event_ids": []
}
],
"gaps": [
{
"action": "Check AIUC coverage",
"hypothesis": "A possible underwriting partner was overlooked.",
"evidence_event_ids": ["original-event-123"]
}
],
"unknowns": ["The agent's hidden internal reasoning"]
}Compare with:
varde decision compare '{"task_id":"TraXin","question_id":"stripe-partnership","expected_models":["chatgpt/gpt-6","claude/claude-sonnet"],"candidate_actions":["Check AIUC coverage"]}'States: DONE (documented action), DELIBERATELY_NOT_DONE (only with model-stated anchored reason), NOT_OBSERVED (absence in visible trace, not proof of non-action), and UNKNOWN. Rationale is labelled as MODEL_STATED, DOCUMENTED_TRACE or ANALYST_INFERRED. Gap hypotheses are not verified blind spots.
Comparison requires matched input_digest, complete source coverage, multiple distinct models and unambiguous observations to report divergence or candidate collective blind spots. Otherwise it reports INSUFFICIENT_EVIDENCE. Shared model training or hidden CoT cannot be inferred from this ledger. The model and source anchors are supplied by the caller and must be verified externally if used as audit evidence. Records grant no execution authority. Collection is explicit through CLI/MCP; no provider-wide automatic session capture is claimed.
Connection Engine — source-anchored candidate discovery
varde connections discover "TraXin"
varde connections propose '<candidate-json-from-discovery>'MCP tools: varde_connection_discover, varde_connection_propose.
Discovery uses owner/project-scoped Dyade search, bounded term expansion, and deterministic candidate ranking over indexed sessions and continuity capsules. Candidates carry original event IDs, status=UNVERIFIED, novelty=NOT_ESTABLISHED, and execution_authorized=false. Proposals are append-only Dyade evidence, not claims or REHT permits. Original sources must be checked before accepting a connection.
This first version is lexical/index-based; it does not claim embeddings, GraphRAG, complete provider history, or verified novelty. Distinct project scopes are not automatically bridged.
Universal Form Engine MVP — shared agent knowledge
Varde exposes the same reusable field vocabulary and draft-preparation engine to all configured MCP agents. It does not automatically collect personal data or submit forms.
varde_form_catalog— list canonical field names and aliases (English/Norwegian).varde_form_inspect— inspect conventional static HTML. Dynamic DOM requires a browser observation adapter.varde_form_prepare— prepare a field-by-field draft from explicitly provided facts and context.varde_form_validate— compare the draft with the original form before a browser adapter may use it.
CLI: varde form catalog; varde form inspect --file input.json;
varde form prepare --file input.json; varde form validate --file input.json.
The input file is a JSON object matching the corresponding MCP data value.
Evidence-preserving FormGraph (candidate extraction)
The shared valo.form-graph.v1 implementation uses VALO's July 19
evidence-preserving requirements: source-byte SHA-256 (or observed DOM snapshot hash), source version,
field locators, extraction provenance, uncertainty and no execution authority.
It describes field candidates, not independently verified source truth.
varde_form_graph_inspect: HTML{data:{html,source_id,version}}.varde_form_pdf_inspect: PDF{data:{base64,source_id,version}}. Requires local Python 3 +pypdf; input is PDF bytes, never an arbitrary file path.varde_form_pdf_auto_inspect: PDF native-widget first, then conservative vector/label candidate detection. Withinclude_ocr:true, also tries the optional offline RapidOCR image parser when neither is sufficient.varde_form_flat_pdf_inspect: read-only geometry/label proposals for born-digital flat PDFs. No automatic filling.varde_form_ocr_pdf_inspect: optional local RapidOCR + PDFium raster OCR with outline geometry, bounded pages and inferred field proposals only. Requires an explicitly configured OCR Python environment; no remote OCR service.varde_form_dom_snapshot: read-only observed fields from an existing browser/page, including JS-rendered fields, open Shadow DOM and frames. This tool accepts a supplied snapshot; it does not open or control a browser.varde_form_graph_validate:{data:{graph}}(digest and structural checks).varde_form_graph_legacy:{data:{graph}}for the existing draft preparation flow.varde_form_pdf_draft:{data:{base64,graph,preparation}}writes an editable PDF draft in memory and returnspdf_base64, SHA-256 and field-by-field coverage. It never submits the form.- CLI:
varde form graph|pdf|flat-pdf|ocr-pdf|auto-pdf|dom|graph-validate|graph-legacy --file input.json. - CLI draft:
varde form pdf-draft --file request.json --output draft.pdfwrites a new file only (refuses to overwrite an existing PDF).
Reviewed drafts for scanned and flat PDFs (Varde 0.4.0)
The opt-in varde_form_raster_draft MCP tool and
varde form raster-draft --file <request.json> --output <draft.pdf>
write only new local draft copies. Unlike the native AcroForm writer,
they use the permissively licensed pypdf library to append text into
manually reviewed answer boxes. The exact source PDF hash and FormGraph
hash must match the prepared evidence; the request must explicitly contain:
{"review":{"schema":"varde.form-review.v1",
"graph_digest":"<exact graph.graph_digest>",
"preparation_digest":"<exact preparation.preparation_digest>",
"confirmation":"REVIEWED_VISUAL_LOCATION","reviewer_id":"operator",
"field_ids":["f0"]}}Only scoped, evidenced, explicitly approved ASCII text with valid positioning can be rendered. Native forms, signed/certified, encrypted, rotated/cropped PDFs, unsupported fields, invalid regions and overlapping selections fail closed. The output is reopened, extracted and reviewed for visible placement. A plain JSON review declaration is not a cryptographically authenticated human identity or an external REHT permit; a production UI must bind reviewers and approval receipts to the exact source and rendered target. Offline text placement changes only the draft PDF, never submits anything.
varde_form_candidate_review and
varde form candidate-review --file <input.json> report overlapping PDF
candidate groups. No candidate is auto-approved; ambiguous regions must be
resolved by an operator. This does not itself prove improved field accuracy.
Independent structural regression: use a pinned native-widget PDF and turn it into a bitmap-only source while keeping its original widget boxes as an external structural reference:
VARDE_OCR_PYTHON=/path/to/ocr-venv/bin/python node scripts/form-native-raster-benchmark.js \
--cache /tmp/varde-public-pdfs --case nz-ir330First run on the previously untuned NZ IR330 source measured 0/15 native widget locations matched and one raster candidate. A separate DS-11 attempt timed out on the bounded OCR adapter. These remain explicit gaps, not suppressed failures. Native widget geometry is independent of our OCR output, not independently human-validated semantic meaning. Any source that informs a parser correction must be moved into development, not reused as an untouched holdout. The current evaluation reports misses, surplus candidates, geometric/type matching and review ambiguity, not universal recall.
OCR backend comparison (requires separately installed Tesseract 5 and RapidOCR, plus local OCR model files):
VARDE_OCR_PYTHON=/path/to/ocr-venv/bin/python node scripts/form-ocr-compare.js \
--cache /tmp/varde-public-pdfsOn the already-tuned model-annotated DVLA V62 sample, both RapidOCR and Tesseract found 10/10 semantic any-hit labels but only 5/10 uniquely resolved regions; 38 suggestions were generated per backend. This is a comparison of two OCR recognizers using the same geometry pipeline, not a comparison with heavyweight VLM parsers such as PaddleOCR-VL/Chandra and not an independently verified ranking. Those models still require their own separate runtime, licensing and benchmark runs before production selection.
The PDF draft writer requires a source-matching, valid native AcroForm graph and a previously validated, tenant-scoped preparation. It writes only editable text widgets; checkboxes, signatures and unsupported fields stay unfilled. The original PDF bytes are never modified. The writer reopens the result and checks the canonical field tree, widget value and appearance stream. PDFs with an existing document/field signature are refused. When an AcroForm has embedded XFA or Adobe Reader-extension usage rights, these are removed only from the generated draft copy, with explicit warnings, so the AcroForm values are not overridden by the XFA representation. A generated draft is never submission-ready by implication.
Example programmatic flow:
const graph = await inspectPdfGraph({ base64, source_id: "form:example" });
const form = legacyFormFromGraph(graph);
const preparation = prepareForm({ form, context, facts, mappings });
const draft = await renderPreparedPdfDraft({ base64, graph, preparation });
// Save draft.pdf_base64 yourself or use the CLI --output flag.
console.log(draft.coverage, draft.warnings);PAT-1 transfer assessment: ADAPTER_PATH (not physical-tested).
Semantic core: a versioned, source-bound observation and preparation,
a bounded adapter-specific state change, and independently re-read outcomes
with explicit partial-coverage reporting. The current pypdf writer is a
document-specific, non-AI implementation, appropriately cheaper than a
model-generated PDF for deterministic field writes. A physical/edge
configuration adapter could reuse that contract only after adding state
freshness, timestamps, units/reference frames, cancellation, idempotency,
local latency limits and physical safety checks. The minimum transfer test
is a simulated device-setting update that checks stale-source rejection,
unrelated-setting preservation and post-write readback against the same
prepared-state semantics. No simulator or hardware qualification has
been performed; physical transfer remains unverified.
src/form-graph.js supports interchangeable HTML, PDF, page-layout and
text-span parser adapters. integrations/pdf/pdf-acroform.js contains
pypdf (BSD-3-Clause) and optional PyMuPDF (AGPL/commercial-license) reference adapters for existing AcroForm fields. PyMuPDF is used only as a local comparison arm, not by the default MCP parser.
When a native PDF widget lacks a human-readable /TU label, the pypdf
adapter conservatively links nearby printed PDF text to the widget rectangle.
Such labels use derivation_type: inferred with label_evidence
(PDF_TEXT, page number, observed text, normalized text anchor), remain
meaning_status: UNKNOWN, and require human review. Visible
“required” language is similarly an inferred hint, not a native PDF
constraint. Fields without a nearby match retain their internal field names and
an explicit unresolved warning; competing candidates may still require review.
Extraction itself does not authorize mapping, writing or submission.
A manual smoke check on the public IRS W-9
identified all 23 native widgets, proposed 12 text labels and detected one
printed required hint; the remaining 11 labels were unresolved. This is one
real-document observation, not a general-purpose coverage estimate.
The auto-router prefers native AcroForm widgets, then proposes labeled vector
rectangles with derivation_type: inferred and explicit visual-review warnings.
Raster-only scans are supported through optional, CPU-only RapidOCR + PDFium:
pip install rapidocr onnxruntime pypdfium2 in an isolated Python environment,
then set VARDE_OCR_PYTHON=/path/to/venv/bin/python. The default auto-router
does not run OCR without include_ocr:true; a missing backend produces an
explicit error, not a fabricated result. The OCR parser checks bundled local
model files and forbids runtime model downloads. PDFs are piped via stdin;
OCR processes only pages without a PDF text layer, at most eight pages
(oversize/remaining pages are flagged). Mixed image/text-layer PDFs require
separate review. OCR outlines and labels are heuristics, with no independent
field confidence.
Real public PDF regression corpus (2026-10-31): Nine pinned, downloadable
government forms from Norway, Canada, the UK, the US and New Zealand
(Skatteetaten RF-1209B, Canada TD1ON fillable/print, HMRC Starter Checklist,
DVLA V62, NZ IR330, US DS-11, W-4 and W-9) are listed with official source URLs,
revision-byte SHA-256, size, page count, and independently enumerated PDF widget counts in
test/fixtures/public-pdf-corpus.json. PDF binaries are not committed or
distributed with the npm package.
node scripts/form-real-corpus.js --list
node scripts/form-real-corpus.js --cache /tmp/varde-public-pdfs --download --with-fitz
# Later runs use the pinned offline cache, without network:
node scripts/form-real-corpus.js --cache /tmp/varde-public-pdfs--download is explicit opt-in, fetches only missing official URLs,
limits size/pages, checks the final redirect host and refuses documents whose
bytes no longer match the pinned snapshot. Source revisions must be reviewed
and re-pinned consciously. Requires Python 3 + pypdf; optional --with-fitz
compares PyMuPDF. The script only reads and proposes; it never fills, sends,
or submits a government form. Its nonzero exit status flags parser failures
and widget-count deviations.
Observed baseline on the pinned PDFs: 277 native widgets across six fillable forms, two born-digital flat print forms and one truly image-only DVLA V62; after allowing empty-user-password PDF decryption (never trying password guesses), pypdf reports all 277 widgets, zero primary native count mismatches, zero structural identity/page/coordinate mismatches, and zero parser failures. Optional PyMuPDF remains a comparison adapter. The field identity check independently enumerates annotations from the same pypdf library; it is not human semantic verification.
Preliminary visual semantics replay: test/fixtures/public-form-visual-anchors.json
pins 24 development answer regions across the Canada print form, HMRC and Norway,
plus ten held-out answer regions on the actual image-only DVLA V62. All are
AI/model-annotated samples awaiting independent human review, not a
complete independently verified truth set. Run:
node scripts/form-visual-benchmark.js --cache /tmp/varde-public-pdfs
# Explicit offline OCR opt-in with preinstalled RapidOCR models:
VARDE_OCR_PYTHON=/path/to/ocr-venv/bin/python node scripts/form-visual-benchmark.js --cache /tmp/varde-public-pdfs --include-ocrOn the exact 24 development annotations, matching location + field type + printed label increased from 7/24 (before changes) to 22/24: Canada 0/8 to 8/8, HMRC 1/8 to 8/8, Norway remains 6/8. The two Norwegian mismatches come from misleading embedded PDF tooltip labels, not missing widget locations. On the DVLA V62 image-only PDF, the default non-OCR route abstains (0/10). The initial contour-only RapidOCR path proposed 34 possible fields, matching 0/10 model-annotated answer regions. The new read-only raster path detects pale-blue answer cells as well as open dark underline geometry, and binds candidates to nearby OCR text. On the same scanned document it proposed 38 candidates with 10/10 sampled location+type+label hits, but five of ten regions have multiple candidates. This result was reached while iterating on this document: DVLA is now DEVELOPMENT evidence, not an independent held-out test. The remaining extra/overlapping proposals have not been independently adjudicated, and no end-to-end value placement was validated on raster forms. A fresh untouched holdout and independently human- verified ground truth are prerequisites for any general accuracy claim. The OCR process remains offline, read-only, bounded and review-only.
The flat-vector adapter now de-duplicates stroked boxes, groups aligned
character cells as text inputs, and detects labeled cells in a multi-column
line grid. When installed, local pdftotext -bbox-layout (Poppler, external
GPL tool) supplies printed label locations that pypdf can omit. It receives
PDF bytes on stdin, is bounded to eight pages, runs with a restricted
environment and a timeout, and never sends data over the network. Without
Poppler, the parser falls back to the conservative pypdf-only path. Flat
results remain candidate proposals requiring review; no filling or submission
is inferred. PAT-1: ADAPTER_PATH, not physical-tested.
No OCR result constitutes proof that the form is complete or ready to submit. integrations/ai-bridge/form-candidates.js
adapts AI-Bridge typed parser responses as inferred candidates.
src/form-benchmark.js measures matched-case detection, labels, types
and geometry. Run node scripts/form-benchmark.js --synthetic in the repo.
With VARDE_OCR_PYTHON set, the matched synthetic benchmark also creates an
image-only PDF fixture using Pillow. Its fixtures are synthetic; no real-world
accuracy claim follows. OCR accuracy and performance on real scans remain unmeasured.
integrations/browser/dom-snapshot.js and src/form-dom.js inspect existing
DOM state without navigation or input mutation. The adapter accepts an
existing Playwright Page, but Varde does not start its own browser.
A preparation input requires form.fields, context.tenant_id and facts.
For project/subject data, provide matching context.project_id and
context.subject_id. A fact contains canonical_key, value, the same
scope keys, and evidence: {source_id, text, digest}, where digest
is SHA-256 of the exact evidence text. The value must occur literally in
that text. Only identical tenant/project/subject scopes are considered.
Conflicts, expired evidence, malformed values, unsupported patterns and
unknown questions remain unfilled. Explicit approved field mappings must
also match tenant and project scope.
The optional integrations/browser/form-browser.js adapter requires both
explicit user review and a trusted REHT-clearance verification callback
before mutating a live DOM. A local callback is not itself a REHT verifier.
DOM changes may trigger website autosave/network effects via event handlers;
the execution boundary must validate the exact action before calling it.
The MCP tools do not operate a live browser or submit forms themselves.
Trust boundary: A matching hash verifies integrity of the supplied text, not authenticity of the original source or correctness of the claim. The caller must verify source identity and access rights independently. Evidence and human review do not grant execution authority. Submission requires a separately implemented VAIG/REHT clearance path and Veritas receipt; those integrations are not part of this MVP.
License
MIT © Njål Solland
Optional Paparats code source for Thread
Set VARDE_PAPARATS_URL to a trusted server's /support/mcp endpoint and set VARDE_PAPARATS_GROUP and VARDE_PAPARATS_PROJECT to an explicit group and project (project all is rejected). Disabled without a URL. Query text is sent to that server; configure its access boundary separately. No tokens are forwarded and redirects fail.
Use varde code search or varde thread search ; MCP exposes varde_code_search and varde_thread_search. Thread returns scoped Dyade memory and Paparats results separately. The upstream file/line/chunk references are preserved verbatim with a response digest. Retrieved code is untrusted evidence; the digest is not proof of repository state. No relationship is inferred or persisted, no original files are verified, and no action is authorized. Coverage is top-k only. Timeout: 10 seconds for the complete handshake and query; response cap: 1 MiB. Unavailable or malformed configured sources fail explicitly.
Federated Google Drive search (optional)
varde drive search "query" and the MCP tool varde_drive_search query Google's existing Drive index directly. They return file IDs, titles, URLs and versions without downloading documents or persisting a parallel Drive index. The tool requires an OAuth access token supplied as VARDE_GOOGLE_DRIVE_TOKEN to the Varde process, with read-only Drive metadata/search permissions; token acquisition and refresh are not automated yet. varde drive changes [pageToken] exposes provider change cursors but does not run background synchronization. The local varde documents sync local <directory> command records file metadata only; it is not a Document Central service integration. No Google Drive account is automatically connected during installation.
Google Drive authorization
Create a Google Cloud OAuth Desktop app client (with Drive API enabled and the appropriate OAuth consent configuration), then set VARDE_GOOGLE_CLIENT_ID in the Varde process environment. Run varde drive connect once and open the displayed Google consent URL in the browser on the same machine. Varde uses PKCE and a temporary loopback callback, stores the refresh token in ~/.config/varde/google-drive-oauth.json (0600), and refreshes access tokens automatically. No Google Drive documents are downloaded. The browser consent and Google Cloud client registration cannot be performed silently; no shared OAuth client is bundled. For non-interactive environments VARDE_GOOGLE_DRIVE_TOKEN remains an explicit short-lived override. Never paste tokens into chat or commit them to Git.
The Thread (unified product name)
The Thread is the user-facing name for continuity across conversations,
agent memory, and machine execution. Install this package as before; both
the-thread and varde invoke the same CLI. Existing varde-mcp, configuration,
state directories, data, and integrations are unchanged. World Commander remains
an independently installed execution service; this alias does not silently
install, rename, or migrate it. Full consolidation of Thread orchestration and
World Commander into one installation is not yet implemented.
