Agenda Intelligence
<!-- mcp-name: io.github.vassiliylakhonin/agenda-intelligence-md -->
# Agenda Intelligence MD
[](https://pypi.org/project/agenda-intelligence-md/) [](https://github.com/vassiliylakhonin/agenda-intelligence-md/actions/workflows/ci.yml) [](LICENSE)
**Agenda Intelligence MD** is a deterministic evidence-packet linter and compliance orchestration engine for claim-backed AI output. It provides verifiable trust boundaries, guardrail enforcement, and evidence-readiness triage across **A2A (Agent-to-Agent)**, **MCP (Model Context Protocol)**, **CLI / Python API**, and **Serverless Edge Workers (Cloudflare)**.
---
## Core concepts
Agenda Intelligence MD is a deterministic evidence-packet linter for claim-backed AI output.
Give it claims, the source IDs each claim relies on, optional quotations, and the supplied source text. It returns broken references, quote mismatches, lexical-support gaps, unmatched numbers, claims that negate the source they cite, and the next reviewer actions.
It reports **packet completeness**, not whether a claim is true:
- not a factuality verifier;
- no autonomous live source retrieval;
- no authorization, approval, or compliance decision;
- human review is required for every result.
---
## First run
Run the canonical synthetic packet from a source checkout:
```bash
git clone https://github.com/vassiliylakhonin/agenda-intelligence-md
cd agenda-intelligence-md
python -m venv .venv
.venv/bin/python -m pip install -e .
.venv/bin/agenda-intelligence check examples/evidence-packet/request.json
```
Expected shape:
```text
packet_status=packet_complete claims=2 sources=1 factuality=not_assessed
c1: packet_complete (lexical_support=supported, coverage=1.0)
c2: packet_complete (lexical_support=supported, coverage=1.0)
```
Use JSON for an agent loop or CI pipeline:
```bash
.venv/bin/agenda-intelligence check examples/evidence-packet/request.json --format json
.venv/bin/agenda-intelligence check examples/evidence-packet/request.json --strict
```
`--strict` exits non-zero unless every claim is `packet_complete`.
Find where a claim could be supported, before deciding what it cites:
```bash
.venv/bin/agenda-intelligence discover examples/evidence-review/manifest.json
```
`discover` derives literal patterns from each claim — figures and quoted spans
first, then content terms, rarest first — and matches every one against every
source, reporting the line that matched. Nothing is sampled and no model is
called, so it behaves the same on 40 sources and on 4,000. It names the sources
a claim's own figures reach but it does not cite, and the ones it cites where
not one pattern occurs. Candidates are places to look: nothing here verifies a
claim, and a source that supports one in different words does not appear at all.
Review local source files without copying their full text into JSON:
```bash
.venv/bin/agenda-intelligence review examples/evidence-review/manifest.json \
--out evidence-review.md --strict
```
The manifest keeps claims explicit and points to local UTF-8, Markdown, DOCX,
or PDF sources. Paths are resolved inside the manifest directory. DOCX support
uses the Python standard library; PDF extraction requires
`pip install -e ".[documents]"`. The command makes no network or model call and
does not include source text in its JSON or Markdown result. See
[`docs/evidence-review.md`](docs/evidence-review.md).
Install the pinned release without cloning the source and check your own packet:
```text
pip install "agenda-intelligence-md==1.11.0"
agenda-intelligence check /path/to/evidence-packet.json --strict
```
Generate an interactive standalone HTML reviewer report from local documents:
```bash
.venv/bin/agenda-intelligence review examples/evidence-review/manifest.json --format html
```
---
## The evidence-packet contract
The request has two required collections:
- `claims`: a claim ID, claim text, declared `source_ids`, and optional verbatim quotes;
- `sources`: a source ID and the text supplied by the caller.
Request schema: [`schemas/v1/evidence-packet-request.schema.json`](schemas/v1/evidence-packet-request.schema.json)
Response schema: [`schemas/v1/evidence-packet-response.schema.json`](schemas/v1/evidence-packet-response.schema.json)
Runnable example: [`examples/evidence-packet/request.json`](examples/evidence-packet/request.json)
The response has three packet statuses:
| Status | Meaning |
|---|---|
| `packet_complete` | References resolve and the named source text has strong lexical overlap with the claim. |
| `source_review_required` | References resolve, but lexical support is weak, a numeric value is not present, or the claim and its closest source sentence disagree on negation. |
| `packet_incomplete` | A source is missing, a quote is absent, or the claim has no source reference. |
`factuality_status` is always `not_assessed`. A complete packet can still rely on a wrong, stale, biased, or irrelevant source.
Numeric support is format-aware but deliberately conservative. Equivalent scaled values, percentages, and common date
forms are compared canonically (`$10M` ↔ `10,000,000 USD`, `62%` ↔ `62 percent`, and `12 May 2024` ↔ `2024-05-12`).
Currency is part of the comparison: `10M USD` does not support `10M EUR`, and the linter performs no currency conversion
or approximate-value inference.
Quote presence remains strict after Unicode, typography, whitespace, ellipsis, soft-hyphen, and PDF line-break
hyphenation normalization. When an otherwise absent quote has a typo-level candidate at 95% similarity or higher,
the quote check may include a bounded `near_miss` diff for the reviewer. It still reports `status: absent` and keeps the
packet incomplete. Candidates whose numeric facts or negation cues differ are not presented as harmless near misses.
### What weighted term overlap can and cannot see
Lexical support is an IDF-weighted share of a claim's content terms that appear in the source it names. Terms that occur
throughout the supplied corpus carry less weight than rare entities, while a single-document packet preserves the original
plain-overlap scale. Corpus text, sentences, numeric facts, and term sets are indexed once per check run and reused across
claims.
**Negation is checked.** `not` and `no` are stopwords and never reach the ratio, so "the board approved it" and "the board did not approve it" score the same against the same source. Where a claim and its closest sentence in the cited source disagree on negation or denial, the claim is downgraded to `weak` and carries `lexical_support_polarity_mismatch`. Polarity is read at sentence scope: a negation elsewhere in the same document does not flag an unrelated claim.
**Reversed roles are not checked, and are not claimed to be.** "A approved a facility for B" and "B approved a facility for A" contain the same terms and both score `supported`. Deciding who did what to whom is not something term overlap can do, and no heuristic here pretends otherwise. A reviewer still has to read the sentence. The limit is pinned by a test (`test_polarity_check_does_not_claim_to_catch_reversed_roles`) so it stays visible.
**Unicode text is tokenized, but language understanding is not claimed.**
Cyrillic and Arabic words are no longer discarded, common Russian and Arabic
function words are excluded from lexical coverage, and common English, Russian,
and Arabic negation cues are checked. A conservative deterministic fold covers
common English plurals/verb suffixes and Russian noun/adjective inflections. It
is not a full morphological analyzer and does not resolve translation,
cross-language support, paraphrases, or semantic roles. Those remain model or
reviewer tasks.
---
## Agent Guardrail & Self-Correction Loop
Validate packets and automatically run agent self-correction feedback loops in LangChain, LlamaIndex, CrewAI, DSPy, or vanilla LLM loops:
```python
from agenda_intelligence.integrations import EvidenceClaim, EvidencePacket, EvidencePacketGuardrail, EvidenceSource
guardrail = EvidencePacketGuardrail(strict=True, max_repair_attempts=2)
# Optional zero-dependency typed input; plain dictionaries remain supported.
packet = EvidencePacket(
claims=(EvidenceClaim("c1", "The board approved the budget.", ("s1",)),),
sources=(EvidenceSource("s1", "The board approved the budget after review."),),
)
# Direct check
result = guardrail.check(packet)
if not guardrail.is_complete(result):
repair_prompt = guardrail.get_repair_prompt(packet_json, result)
# Provide repair_prompt back to LLM to revise output
# Automated retry loop with custom LLM generation function
final_packet, success, repair_history = guardrail.validate_or_repair(
packet_json,
llm_repair_fn=lambda prompt: my_llm_chain.invoke({"prompt": prompt}),
)
# Event-loop pipelines can await check_async(...) or validate_or_repair_async(...).
# LangGraph can use the dependency-free async node returned by:
node = guardrail.as_langgraph_node(packet_key="evidence_packet", result_key="evidence_check")
```
---
## Concurrency & A2A Demos
The repository includes runnable end-to-end demonstrations of the agent-first architecture:
- **Bounded concurrency example ([`examples/infinite-swarm-batch.py`](examples/infinite-swarm-batch.py))**: Sends 250 synthetic requests and reports transport latency and actual task states. It is a load demonstration, not a capacity benchmark or comparison with staff.
- **A2A step-up simulation ([`examples/agent-to-agent-negotiation.py`](examples/agent-to-agent-negotiation.py))**: Demonstrates a synthetic request being stopped until operator-authorization evidence is supplied. No real transaction is authorized.
- **Profile scaffolder ([`scripts/agent-factory.py`](scripts/agent-factory.py))**: Creates starter files for a proposed vertical profile. Generated files are inactive until schemas, implementation, tests, and review are added.
---
## GitHub Action CI Integration
Add deterministic evidence linting to your repository CI workflow (`.github/workflows/evidence-lint.yml`):
```yaml
name: Evidence Lint
on: [push, pull_request]
permissions:
contents: read
security-events: write
jobs:
lint-evidence:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate evidence packet
uses: vassiliylakhonin/agenda-intelligence-md@main
with:
path: 'evidence/packet.json'
command: 'check'
format: 'sarif'
strict: 'true'
```
With `format: sarif`, findings are uploaded to GitHub code scanning and point to the corresponding `claim_id` line in
the packet JSON. `text` and `json` output remain available.
---
## Python API
```python
import json
from pathlib import Path
from agenda_intelligence.services import check_evidence_packet, build_repair_prompt
packet = json.loads(Path("examples/evidence-packet/request.json").read_text())
result = check_evidence_packet(packet)
print(result["response"]["packet_status"])
# Generate actionable markdown repair instructions for an agent
if result["response"]["packet_status"] != "packet_complete":
prompt = build_repair_prompt(packet, result["response"])
print(prompt)
```
The service layer is stateless. It does not persist packet contents or fetch missing sources.
---
## What this is
- A small JSON contract for claim-backed AI output.
- A deterministic preflight before human review.
- A CLI and Python service suitable for local and CI use.
- A local-file review adapter that returns a reviewer-facing Markdown or JSON result.
- An inspectable base for domain-specific compatibility profiles.
## What this is not
- A general LLM evaluation platform.
- A GRC, vendor-management, or document-storage system.
- An agent authorization or policy-enforcement layer.
- Legal, compliance, sanctions, financial, investment, insurance, or trading advice.
- Proof that a source or claim is factually correct.
---
## Why a repo full of markdown?
The repository predates the evidence-packet focus and also packages agent reasoning instructions. Files under `skills/` are executable instructions for compatible agent runtimes, not ordinary prose documentation. They remain available for compatibility, but they are not the primary product interface.
---
## MCP
The packaged MCP server exposes the same evidence-packet preflight to agent clients:
```json
{
"mcpServers": {
"agenda-intelligence": {
"command": "uvx",
"args": ["--from", "agenda-intelligence-md", "agenda-intelligence-mcp"]
}
}
}
```
Run a focused stdio example against an editable install:
```bash
.venv/bin/python examples/evidence-packet/mcp_client.py \
--command ".venv/bin/agenda-intelligence-mcp"
```
The example initializes the MCP server, calls `check_evidence_packet` with the
synthetic packet, and prints only the review summary. See
[`examples/evidence-packet/mcp_client.py`](examples/evidence-packet/mcp_client.py)
and [`MCP.md`](MCP.md).
Before using the result for an irreversible or high-stakes action, record the
goal, supplied evidence, suspected unreliable evidence, assumptions, intended
action, and stop/escalation conditions. The tool checks packet structure, not
whether a claim is true or an action is authorized.
Existing MCP tools such as `audit_claims`, `verify_quotes`, `grounded_check`,
and `verify_claims` remain compatible; no tool was removed or renamed.
`pre_action_check` adds a stateless action boundary on top of the existing
claim audit. It returns `continue`, `request_evidence`, `require_approval`, or
`stop` from caller-supplied evidence, risk, policy-check results, and an
optional external approval reference. The caller still authenticates the
actor, stores approvals, enforces the result, and performs the action. The
request and response contracts are
[`pre-action-check-request.schema.json`](schemas/v1/pre-action-check-request.schema.json)
and
[`pre-action-check-response.schema.json`](schemas/v1/pre-action-check-response.schema.json).
Twenty illustrative replay cases are in
[`examples/pre-action-check/replay-cases.json`](examples/pre-action-check/replay-cases.json).
Two authoring tools, `create_brief` and `append_evidence`, let an agent assemble a brief or an evidence pack step by step inside the contract instead of hand-building JSON and validating it afterwards. Both are deterministic and stateless: they validate on every call and return the document to the caller. They do not write files, retrieve sources, draft prose, or assess factual truth, and `append_evidence` never infers a `supported` claim status on its own.
Claude Code plugin installation also remains available:
```text
/plugin marketplace add vassiliylakhonin/agenda-intelligence-md
/plugin install agenda-intelligence@agenda-intelligence
```
---
## Compatibility profiles and adapters
The strategic-intelligence shell, HTTP API, A2A adapter, Cloudflare Workers, and five domain profiles remain in the repository. They demonstrate how the same service layer can be wrapped for different transports and domains. They represent active prototypes and technical wedges for vertical domains.
| Compatibility surface | Reference |
|---|---|
| Strategic agenda analysis | [`Agenda-Intelligence.md`](Agenda-Intelligence.md) |
| HTTP API | [`docs/deployment/http-api.md`](docs/deployment/http-api.md) |
| A2A adapter | [`docs/deployment/a2a-adapter.md`](docs/deployment/a2a-adapter.md) |
| Middle Corridor example | [`docs/use-cases/kazakhstan-middle-corridor.md`](docs/use-cases/kazakhstan-middle-corridor.md) |
| CIS secondary-sanctions example | [`docs/use-cases/cis-secondary-sanctions.md`](docs/use-cases/cis-secondary-sanctions.md) |
| Agentic interaction example | [`docs/use-cases/agentic-interaction-trust.md`](docs/use-cases/agentic-interaction-trust.md) |
| Gulf maritime example | [`docs/use-cases/gulf-maritime-exposure.md`](docs/use-cases/gulf-maritime-exposure.md) |
| Kazakhstan market-entry example | [`docs/use-cases/kazakhstan-market-entry-readiness.md`](docs/use-cases/kazakhstan-market-entry-readiness.md) |
| Live A2A demo pack | [`docs/agenstry/demo-pack.md`](docs/agenstry/demo-pack.md) |
The compatibility profiles are evidence-routing examples only. They do not provide legal, compliance, sanctions, financial, investment, insurance, or trading advice. Human review is required before any commercial action.
---
## Verification Contract
The repository keeps three checks separate:
1. `check` reports packet completeness and lexical-support diagnostics.
2. `grounded-check` performs the older claim-to-corpus lexical diagnostic.
3. `verify-claims` applies declared freshness, authority, independence, jurisdiction, and identifier rules to caller-supplied evidence.
None discovers the right sources for the caller. `verified` in the bounded Claim Verdict contract means the supplied evidence meets that declared contract; it is not absolute truth.
---
## Schemas
Canonical schemas live under [`schemas/v1/`](schemas/v1/). Packaged copies under `src/agenda_intelligence/data/schemas/v1/` must remain byte-equivalent; CI checks this invariant.
Start with:
- [`evidence-packet-request.schema.json`](schemas/v1/evidence-packet-request.schema.json)
- [`evidence-packet-response.schema.json`](schemas/v1/evidence-packet-response.schema.json)
- [`evidence-review-request.schema.json`](schemas/v1/evidence-review-request.schema.json)
- [`evidence-audit.schema.json`](schemas/v1/evidence-audit.schema.json)
- [`claim-verification-request.schema.json`](schemas/v1/claim-verification-request.schema.json)
The full registry is in [`agent-manifest.json`](agent-manifest.json).
---
## Before / after and benchmarks
The older agenda-analysis evaluation surface remains available for regression and compatibility work:
- [`examples/before-after/eu-ai-act.md`](examples/before-after/eu-ai-act.md)
- [`examples/before-after/red-sea-shipping.md`](examples/before-after/red-sea-shipping.md)
- [`examples/before-after/sanctions-routing.md`](examples/before-after/sanctions-routing.md)
- [`examples/source-backed/eu-ai-act.md`](examples/source-backed/eu-ai-act.md)
These are evaluation fixtures, not customer evidence or production benchmarks.
---
## AnalysisBank
[`analysis-bank/`](analysis-bank/) contains compatibility fixtures for reasoning-memory retrieval and failure-pattern regression. It is not part of the primary evidence-packet workflow.
---
## Web3 UI & Autonomous Micropayment Rails (x402 on Base)
Agenda Intelligence MD natively integrates the **x402 protocol** on **Base** (Chain ID `8453`, USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`), unlocking zero-custody, machine-to-machine micropayments and self-service compliance intelligence for autonomous AI agents and institutional reviewers.
### Interactive Web3 Screener: `/corridor-bankability`
Visit the interactive Trans-Caspian Corridor Bankability Screener at `/corridor-bankability` on any hosted Worker (e.g., [`https://agenda-intelligence-a2a.vassiliy-lakhonin.workers.dev/corridor-bankability`](https://agenda-intelligence-a2a.vassiliy-lakhonin.workers.dev/corridor-bankability)):
- **Brave / Web3 Wallet Connection**: Native browser wallet connect via Base network.
- **Instant CapEx & Covenant Stress-Testing**: Evaluate debt covenants, sovereign guarantee backing, and DSCR metrics across Aktau-Baku, Poti-Constanța, and Middle Corridor transit legs.
- **On-Chain $25 USDC Unlock**: Pay the $25.00 IFI Dossier unlock directly with your wallet to receive an unredacted institutional bankability report with full sensitivity tables and multilateral bank readiness scores.
### Autonomous Agent Discovery & x402 Pricing Tiers
Every agent in the fleet advertises native x402 metadata via `agentCard` to autonomous registries (e.g., `skillget.dev`, `AgenstryBot`, `ZeroMockProof`):
| Tier | Price (USDC on Base) | Scope & Capability | Endpoint |
|---|---|---|---|
| **Micro-Check** | `$0.05` | Instant single-probe compliance & screening triage | `/v1/settle` |
| **Corridor Bankability Dossier** | `$25.00` | Full unredacted IFI deal dossier with debt metrics | `/v1/corridor-bankability/screen` |
| **Dedicated Pro Tenant** | `$490.00` / mo | High-throughput dedicated rate limits & API token | `/v1/settle` |
### Smart Fallback for Autonomous AI Agents
Autonomous agents interacting over A2A (`message/send`) or REST (`/v1/...`) can send natural language prompts (e.g., *"Screen LLP KazTransSupply in Kazakhstan for secondary sanctions"*, *"Due diligence for rare earth extraction in East Kazakhstan"*, or *"Assess MT Gulf Pioneer transiting Hormuz"*). The smart fallback engine heuristics extract counterparties, commodities, chokepoints, and jurisdictions with sensible defaults while explicitly declaring `inferred_parameters: true` to guarantee compliance traceability.
---
## Status
| Surface | Status |
|---|---|
| Evidence-packet request/response schemas | Implemented |
| `check_evidence_packet` Python service | Implemented |
| `agenda-intelligence check` packet auto-detection | Implemented |
| `agenda-intelligence review` local-file workflow | Implemented for UTF-8, Markdown, DOCX, and optional PDF input |
| `agenda-intelligence review --format html` | Implemented (Generative UI) |
| `check_evidence_packet` MCP tool | Implemented |
| AI Fleet (Vertical Workers) | Active (12 profiles deployed on Cloudflare Edge) |
| Interactive Web3 UI (`/corridor-bankability`) | Active (Brave / Web3 Wallet on Base) |
| x402 Base Micropayments | Active (USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`) |
| Agent Financial Guard | Implemented (Pre-sign transaction firewall for AI agents) |
| M2M Escrow Arbiter & Base Contract | Implemented (Autonomous B2B dispute resolution on Base) |
| Live Source Retrieval | Optional per profile; currently unconfigured in the hosted fleet |
Current classification: `Ecosystem Expansion & R&D`.
---
## Documentation
| Topic | File |
|---|---|
| Pitch Deck (12 Slides) | [`docs/pitch/PITCH_DECK.md`](docs/pitch/PITCH_DECK.md) |
| Case Studies | [`docs/pitch/CASE_STUDIES.md`](docs/pitch/CASE_STUDIES.md) |
| Unit Economics | [`docs/pitch/UNIT_ECONOMICS.md`](docs/pitch/UNIT_ECONOMICS.md) |
| Adoption | [`ADOPTION.md`](ADOPTION.md) |
| Quickstart | [`docs/quickstart.md`](docs/quickstart.md) |
| Evidence audit | [`docs/evidence-audit.md`](docs/evidence-audit.md) |
| Local evidence review | [`docs/evidence-review.md`](docs/evidence-review.md) |
| Factuality boundary | [`docs/factual-verification.md`](docs/factual-verification.md) |
| Evaluation | [`docs/evaluation.md`](docs/evaluation.md) |
| Source policy | [`SOURCE_POLICY.md`](SOURCE_POLICY.md) |
| Security | [`SECURITY.md`](SECURITY.md) |
| Threat model | [`docs/threat-model.md`](docs/threat-model.md) |
| Roadmap | [`ROADMAP.md`](ROADMAP.md) |
---
## Repository layout
```text
schemas/v1/ public JSON contracts
src/agenda_intelligence/ Python service and transport adapters
examples/evidence-packet/ canonical packet example
tests/ contract and regression tests
skills/ compatibility agent instructions
deploy/cloudflare-worker/ compatibility Worker implementation
docs/ reference and compatibility documentation
```
---
## Development
```bash
pip install -e ".[dev]"
make ci
make verification-report
```
`make verify-local` also runs the compatibility Cloudflare Worker tests.
`make verification-report` runs both verification surfaces and writes
`.verification/results.json`: a deterministic, machine-readable record of the
checks and hashed contracts. It uses no paid APIs and deliberately makes no
claim about factual truth, live deployment health, adoption, or market value.
---
## Roadmap
The current phase focuses on **Product-Led Growth & Ecosystem Expansion**.
We are rapidly iterating on Generative UI for interactive evidence dashboards, deploying new vertical AI workers for adjacent domains (e.g., ESG, supply chain), and registering capabilities with agent catalogs (Agenstry).
See [`ROADMAP.md`](ROADMAP.md) for the active expansion initiatives.
---
## License
[MIT](LICENSE)
TDQS
Scored across 31 tools
Several tools occupy overlapping territory: grounded_check, check_evidence_packet, and verify_quotes all perform local lexical/quote checks, while audit_claims and agent_output_verification both consume evidence-audit JSON and report orphaned or unsupported claims. The descriptions try to differentiate, but an agent would struggle to choose among validate_evidence, check_evidence_packet, audit_claims, and verify_claims. Clear retrieval tools like get_protocol and list_lenses stand apart, but the validation/verification cluster blurs boundaries.
Most tools use lowercase snake_case verb_noun names like validate_memo, list_signals, and create_brief, but the vertical risk tools break the pattern with noun-phrase names like middle_corridor_deal_risk, gulf_maritime_exposure, and kazakhstan_market_entry_readiness. Verb choice is also inconsistent across similar actions (validate/check/audit/verify). The names are still readable and uniformly lowercase, but there is no consistent convention.
At 31 tools, the surface is heavy, and it exceeds the 16-25 range that already feels bloated for most MCP servers. The count is inflated by near-redundant validators and checkers, plus a reserved deep_dive placeholder that performs no analysis. Many of these tools could be consolidated without losing real capability.
The toolkit covers the full evidence-discipline lifecycle: building inputs (create_brief, append_evidence), validating schemas (validate_brief/evidence/memo), checking grounding and quality (grounded_check, verify_quotes, check_memo_quality), generating analyses (analyze and verticals), and gating actions (pre_action_check). Minor gaps include the non-functional deep_dive placeholder and the lack of a broader post-analysis refinement tool, but the core workflow is well covered.