AKF 标志

AKF

社区
HMAKT99

Trust metadata for AI agents — a stamp costs ~15 tokens, re-verifying costs 15,000. Agents stamp what they verify; the next agent runs 'akf check' and builds on it. pip install akf

发布者HMAKT99
代码仓库AKF
语言Python
复刻数
2
星标数
16
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    AKF 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 16 个 Star 和 2 个 Fork。


_akf: '{"v":"1.0","claims":[{"c":"Trust metadata for README.md","t":0.7,"id":"1979cbeb","src":"unspecified","tier":5,"ver":false,"ai":true,"evidence":[{"type":"other","detail":"updated certify and github action references","at":"2026-03-18T04:21:48.869226+00:00"}]}],"id":"akf-c33254656fc5","agent":"claude-code","at":"2026-03-18T04:21:48.870623+00:00","label":"public","inherit":true,"ext":false,"sv":"1.1"}'


Paste this to your agent

Don't install AKF yourself — let your agent do it. Paste this into Claude Code, Cursor, OpenClaw, or any coding agent:

Install AKF (pip install akf, or pipx install akf) and set it up: run `akf init --git-hooks`.
From now on:
- After you create or modify a file, stamp it:
    akf stamp <file> --agent <your-id> --evidence "<what you verified, e.g. 42/42 tests passed>"
- Before building on any existing file, check it first:
    akf check <file>
  OK = fresh stamp with verified evidence, skip re-verification. STALE/LOW/UNSTAMPED = verify before trusting.
If you support MCP, also register the server: {"mcpServers":{"akf":{"command":"python","args":["-m","mcp_server_akf"]}}}

Your agent installs its own provenance layer — and every file it touches carries trust metadata from then on.

Why agents need this

Agents redo work constantly: re-read files, re-run tests, re-derive conclusions — because nothing tells them what was already verified. A stamp is cached verification state:

console
# Session 1 — agent fixes auth, tests pass
$ akf stamp auth.py --agent claude-code --evidence "42/42 tests passed"

# Session 2 — tomorrow, any agent, any tool
$ akf check auth.py
OK trust=0.65 agent=claude-code evidence=test_pass age=1d claims=1
# → build on it, skip re-verification

# Someone edits auth.py without re-testing
$ akf check auth.py
STALE trust=0.65 agent=claude-code evidence=test_pass age=1d claims=1 reason=modified_after_stamp
# → re-verify before trusting (exit code 1 — gate CI or hooks on it)

Stamps are trail markers agents leave for other agents — across sessions, across tools (Claude Code → Cursor → Copilot), across teams. Humans get the same trail: who made this file, AI or human, was it tested, can we trust it.

What travels with the fileHow
Trust score0–1 confidence, weighted by evidence and source tier
Verification evidencetests passed, type check clean, human reviewed — with timestamps
Source provenanceSEC filing → analyst → AI agent chain
ComplianceOne command: akf audit file --regulation eu_ai_act

Don't trust the stamp — re-run it

A signature proves who said it; a replay proves it could have been true. A stamp can carry a falsifiable probe recipe, so the next agent re-verifies the claim instead of trusting the label:

console
# Stamp with a recipe that can be re-run
$ akf stamp auth.py --agent claude-code --evidence "42/42 tests passed" --replay "pytest -q"

# Later — re-run the probe instead of trusting the stamp
$ akf replay auth.py --run
CONFIRMED inputs=intact

# A dependency moved since the stamp was written
$ akf replay auth.py --run
CONFIRMED_DRIFTED inputs=drifted   # probe still passes, but against a changed world — re-check

REFUTED when the probe fails, UNREPLAYABLE when there's no recipe. This is the answer to "a trusted source can still be wrong": trust stops depending on who signed it, for any claim with a runnable check.

Quickstart

bash
pip install akf    # Python
npm install akf-format    # TypeScript / Node.js

akf doctor         # Check your install — detects PATH issues and guides setup

akf command not found? Run akf doctor to auto-detect your setup, or use python3 -m akf (always works).

  • Install with pipx: pipx install akf (recommended — auto-handles PATH)
  • Windows: use python3 -m akf or install via pipx
bash
# The core loop — stamp what you verified, check before you trust
akf stamp auth.py --agent claude-code --evidence "42/42 tests passed"
akf check auth.py        # OK trust=0.65 agent=claude-code evidence=test_pass age=0d
python
import akf

# Same loop from Python
akf.stamp_file("auth.py", agent="claude-code", evidence=["42/42 tests passed"])
result = akf.check_file("auth.py")
print(result.summary_line())   # OK trust=0.65 agent=claude-code evidence=test_pass age=0d claims=1

# Embed into Office docs, PDFs, images — any format
akf.embed("report.docx", claims=[...], classification="confidential")

# Audit for compliance (EU AI Act, HIPAA, SOX, GDPR, NIST AI, ISO 42001)
result = akf.audit("report.akf", regulation="eu_ai_act")
print(f"Compliant: {result.compliant}")

TypeScript / Node.js (akf-format):

typescript
import { create, validate, effectiveTrust, stampFile } from 'akf-format';

// Create a trust-stamped unit from any AI output
const unit = create('Revenue was $4.2B, up 12% YoY', 0.98, {
  source: 'SEC 10-Q',
  agent: 'claude-code',
});

// Validate against the AKF schema
const { valid } = validate(unit);

// Compute effective trust for a claim
const trust = effectiveTrust(unit.claims[0]);
console.log(`valid: ${valid}, score: ${trust.score}, decision: ${trust.decision}`);

// Stamp trust metadata directly into a file (markdown, json, code, …)
stampFile('report.md', { agent: 'claude-code', evidence: 'tests pass' });

Full TypeScript API and more examples: typescript/README.md.

For AI Agents

AKF is designed agent-first. One-line APIs for checking, stamping, streaming, and auditing.

python
import akf

# Check before you trust — can I build on this file without re-verifying?
result = akf.check_file("auth.py")
if result.status == "OK":      # fresh stamp, verified evidence
    ...                        # skip re-verification, save the tokens
# LOW / STALE / UNSTAMPED → verify before trusting

# Stamp with evidence (auto-detected: test_pass, type_check, human_review, etc.)
akf.stamp("Fixed auth bypass", kind="code_change",
          evidence=["42/42 tests passed", "mypy: 0 errors"],
          agent="claude-code", model="claude-sonnet-4-20250514")

# Stream trust metadata in real-time
with akf.stream("output.md", model="gpt-4o") as s:
    for chunk in llm_response:
        s.write(chunk)

# Trust-annotated git commits (uses git notes)
akf.stamp_commit(content="Refactored auth module", kind="code_change",
                 evidence=["all tests pass"], agent="claude-code")
print(akf.trust_log(n=10))  # + ACCEPT  ~ LOW  - REJECT  ? none

Multi-Agent Teams

AKF supports multi-agent orchestration — Claude Agent Teams, Copilot Cowork, Codex multi-agent, and any A2A-compatible platform.

python
import akf

# Agent-to-agent delegation with trust ceiling
policy = akf.DelegationPolicy(
    delegator="lead-agent", delegate="research-bot",
    trust_ceiling=0.7, allowed_actions=["search", "summarize"]
)
result = akf.delegate(parent_unit, policy)

# Multi-agent streaming session
with akf.TeamStream(["research", "writer", "reviewer"]) as ts:
    ts.write("research", "Found 3 sources", confidence=0.8)
    ts.write("writer", "Drafted summary", confidence=0.75)
    ts.write("reviewer", "Approved with edits", confidence=0.9)
    scores = ts.aggregate()  # per-agent + team trust

# Cross-platform agent identity
card = akf.create_agent_card(name="Research Bot", platform="claude-code",
                             capabilities=["search", "summarize"])
akf.verify_agent_card(card)  # SHA-256 hash verification

# Team certification (per-agent breakdown)
report = akf.certify_team("src/", min_trust=0.7)
# report.all_agents_certified — each agent must individually pass

CLI:

bash
akf agent create --name "Bot" --platform claude-code --capabilities search,summarize
akf agent list
akf agent verify <id>
akf agent export-a2a <id> --output card.json   # A2A protocol bridge
akf agent import-a2a card.json
akf certify src/ --team                         # Per-agent breakdown

MCP Server

AKF ships an MCP server so any AI agent can create, validate, scan, and audit trust metadata.

bash
# Install from the repo
pip install ./packages/mcp-server-akf
json
{
  "mcpServers": {
    "akf": {
      "command": "python",
      "args": ["-m", "mcp_server_akf"]
    }
  }
}

11 MCP tools: check_file · replay_file · create_claim · validate_file · scan_file · trust_score · stamp_file · audit_file · embed_file · extract_file · detect_threats

Ambient Trust

AKF works where AI agents work. Drop a config file, and every AI-generated file carries trust metadata automatically.

AgentHow it works
Claude CodePlugin: /plugin marketplace add HMAKT99/AKF → /plugin install akf — auto-stamp hook + check skill. Or reads CLAUDE.md
CursorReads .cursorrules — stamps AI edits before you review
WindsurfReads .windsurfrules — stamps AI edits with trust metadata
GitHub CopilotReads .github/copilot-instructions.md (native) + shell hook for CLI
OpenAI CodexReads AGENTS.md — stamps files in cloud sandbox and local
OpenClawSkill on ClawHub: clawhub install akf — check/stamp protocol + memory trust
Hermes Agentagentskills.io skill: hermes skills tap add HMAKT99/AKF — files, memories, and skill supply-chain
Manus / Other AgentsMCP server + shell hook — works with any agent that supports MCP or CLI
Any MCP agent11 MCP tools — check, replay, stamp, audit, embed, extract, detect, validate, scan, trust, create
Any CLI tooleval "$(akf shell-hook)" — intercepts claude, chatgpt, aider, openclaw, ollama, manus

The trust pipeline:

Agent writes code → Git commit stamped → CI runs akf certify → Team reviews with context

Set up in 60 seconds:

bash
# 1. Agent stamps its own work (already in this repo)
cat CLAUDE.md        # or .cursorrules / .windsurfrules / AGENTS.md / .github/copilot-instructions.md

# 2. Git hooks stamp every commit
akf init --git-hooks

# 3. CI certifies trust on every PR
#    uses: HMAKT99/AKF/extensions/github-action@main

# 4. Shell hook intercepts AI CLI tools
eval "$(akf shell-hook)"

Skills

AKF provides agent skill files that AI agents can discover and use. Drop these into your agent's context:

SkillWhat it does
check.mdCheck a file's trust before building on it
stamp.mdStamp trust metadata onto AI outputs
audit.mdAudit files for regulatory compliance
scan.mdSecurity scan files and directories
embed.mdEmbed trust metadata into Office/PDF/images
detect.mdRun 10 security detection classes
stream.mdStream trust metadata in real-time
git.mdTrust-annotated git workflows
convert.mdConvert between formats
delegateAgent-to-agent trust delegation
teamMulti-agent streaming sessions

Format at a Glance

Compact (~15 tokens — optimized for AI):

json
{"v":"1.0","claims":[{"c":"Revenue was $4.2B","t":0.98,"src":"SEC 10-Q"}]}

Descriptive (human-readable — same data):

json
{"version":"1.0","claims":[{"content":"Revenue was $4.2B","confidence":0.98,"source":"SEC 10-Q"}]}

Full (with provenance, decay, AI flags, security):

json
{"v":"1.0","by":"sarah@acme.com","label":"confidential","inherit":true,
 "claims":[
   {"c":"Revenue $4.2B","t":0.98,"src":"SEC 10-Q","tier":1,"ver":true,"decay":90},
   {"c":"H2 will accelerate","t":0.63,"tier":5,"ai":true,"risk":"AI inference"}
 ],
 "prov":[
   {"hop":0,"by":"sarah@acme.com","do":"created","at":"2025-07-15T09:30:00Z"},
   {"hop":1,"by":"copilot-agent","do":"enriched","at":"2025-07-15T10:15:00Z"}
 ]}

Works With Every Format

AKF embeds natively — no sidecars needed for most formats:

FormatHow It Works
.akfNative standalone knowledge file
.docx .xlsx .pptxOOXML custom XML part
.pdfPDF metadata stream
.htmlJSON-LD <script type="application/akf+json">
.mdYAML frontmatter
.png .jpgEXIF/XMP metadata
.jsonReserved _akf key
.mp4 .mov .webm .mkvSidecar .akf.json companion
.mp3 .wav .flac .oggSidecar .akf.json companion
Everything elseSidecar .akf.json companion
python
# One API for all formats
akf.embed("report.docx", claims=[...], classification="confidential")
meta = akf.extract("report.docx")
akf.scan("report.docx")

Zero-Touch Auto-Stamping

AKF can automatically stamp every file AI touches — no manual intervention needed.

bash
# Install the background watcher
akf install

# Or run in foreground
akf watch ~/Downloads ~/Desktop ~/Documents

The background watcher monitors directories for new and modified files and stamps them with trust metadata. Smart context detection automatically infers:

  • Git author — from git log history
  • Download source — from macOS extended attributes
  • Classification — from project .akf/config.json rules
  • AI-generated flag — from LLM tracking timestamps + content heuristics
  • Confidence score — dynamically adjusted based on available evidence

Shell Hook (intercept AI CLI tools)

bash
# Add to ~/.zshrc or ~/.bashrc
eval "$(akf shell-hook)"

Automatically detects when you run claude, chatgpt, aider, openclaw, ollama, or other AI CLI tools, and stamps any files they create or modify. Also pre-stamps files before upload to content platforms (gws, box, m365, dbxcli, rclone) so trust metadata travels with the file. Use --no-upload-hooks to disable.

Project Rules

Create .akf/config.json in your project root:

json
{
  "rules": [
    {"pattern": "*/finance/*", "classification": "confidential", "tier": 2},
    {"pattern": "*/public/*", "classification": "public", "tier": 3}
  ]
}

Files matching these patterns are automatically classified when stamped.

CLI

bash
# ── Quick start ──
akf                          # Welcome + quick start
akf quickstart               # Interactive demo
akf doctor                   # Check installation health

# ── Stamp & create ──
akf create report.akf \
  --claim "Revenue $4.2B" --trust 0.98 --src "SEC 10-Q" \
  --by sarah@acme.com --label confidential

# ── Check before you trust ──
akf check auth.py            # One line: OK / LOW / STALE / UNSTAMPED
akf check auth.py --json     # Structured output; exit codes 0/1/2 for gating
akf replay auth.py           # Inspect the stamp's falsifiable probe recipe
akf replay auth.py --run     # Re-run it: CONFIRMED / CONFIRMED_DRIFTED / REFUTED

# ── Validate & inspect ──
akf validate report.akf
akf inspect report.akf
akf trust report.akf

# ── Certify (aggregate pass/fail gate) ──
akf certify report.akf                        # Trust + detection + compliance
akf certify src/ --min-trust 0.8              # Custom threshold
akf certify . --evidence-file results.xml     # Attach test evidence
akf certify . --format json --fail-on-untrusted  # CI-friendly output
akf certify src/ --team                       # Per-agent trust breakdown

# ── Compliance ──
akf audit report.akf                          # Compliance readiness check
akf audit report.akf --regulation eu_ai_act   # EU AI Act
akf audit report.akf --trail                  # Audit trail

# ── Universal format commands ──
akf embed report.docx --classification confidential \
  --claim "Revenue $4.2B" --trust 0.98
akf extract report.docx
akf scan report.docx
akf scan ./docs/ --recursive
akf scan . --badge badge.json     # shields.io endpoint: "14% stamped · trust 0.76"

# ── Auto-stamping ──
akf install                                   # Install background watcher
akf watch ~/Downloads ~/Documents             # Watch directories
akf shell-hook                                # Print shell hook code
akf shell-hook --no-upload-hooks              # Without content platform hooks
akf uploads                                   # View upload stamp log

# ── Git integration ──
akf stamp <file> --agent claude-code --evidence "tests pass"

# ── Agent identity & teams ──
akf agent create --name "Bot" --platform claude-code
akf agent list
akf agent verify <agent_id>
akf agent export-a2a <id> --output card.json  # A2A protocol bridge
akf agent import-a2a card.json

# ── Knowledge Base ──
akf kb stats ./kb
akf kb query ./kb --topic finance

Security Detections

10 built-in detection classes: AI content without review, trust below threshold, hallucination risk, knowledge laundering, classification downgrade, stale claims, ungrounded AI claims, trust degradation chain, excessive AI concentration, provenance gap.

python
from akf import run_all_detections
report = run_all_detections(unit)
for finding in report.findings:
    print(f"[{finding.severity}] {finding.detection}: {finding.message}")

Trust Computation

effective_trust = confidence × authority_weight × temporal_decay × (1 + penalty)
TierWeightExample
11.00SEC filings, official records
20.85Analyst reports, peer-reviewed
30.70News, industry reports
40.50Internal estimates, CRM data
50.30AI inference, extrapolations

Decision: score ≥ 0.7 → ACCEPT · ≥ 0.4 → LOW · < 0.4 → REJECT

Delegation ceiling: When an agent delegates to another, the delegate's output trust is capped at min(score, delegation_ceiling). This prevents trust inflation in multi-agent chains.

Integrations & Extensions

Framework integrations (install from repo via pip install ./packages/<name>):

PackageDescription
mcp-server-akfMCP server — create, validate, scan, trust
langchain-akfLangChain callback handler + document loader (experimental)
llama-index-akfLlamaIndex node parser + trust filter (experimental)
crewai-akfCrewAI tool for trust-aware agents (experimental)

Editor & CI extensions (source in repo):

ExtensionDescription
VS CodeSyntax highlighting, hover info, validation for .akf files
VS Code AI MonitorAuto-stamp files edited by Copilot, Cursor, and other AI tools
GitHub ActionCI trust gate — runs akf certify on PRs with optional PR comments
Google WorkspaceAdd-on for Docs, Sheets, Slides (preview)
Office Add-inAdd-in for Word, Excel, PowerPoint (preview)

For LLMs

Prompt with one example and LLMs produce valid AKF 95%+ of the time:

Output knowledge as AKF:
{"v":"1.0","claims":[{"c":"<claim>","t":<0-1>,"src":"<source>","tier":<1-5>,"ai":true}]}

See LLM-PROMPT.md for a full system prompt.

Documentation

DocDescription
Full SpecComplete format specification
JSON SchemaMachine-readable schema
Producing AKFQuick start for 8 languages
Trust ComputationScoring algorithm details
Falsifiable EvidenceReplay recipes — re-run the probe, don't trust the label
Agent MemoryTrust-decayed memory stamps
Skill ProvenanceSupply-chain trust for skill files
LLM IntegrationPrompting strategies
EU AI ActCompliance mapping
NIST AI RMFFramework mapping

vs Alternatives

AKFC2PAWatermarkingManual tracking
Works on documents/code✅❌ (media only)❌⚠️
No Certificate Authority needed✅❌✅✅
Trust scores✅❌❌❌
Source provenance chain✅✅❌⚠️
Compliance auditing✅❌❌❌
~15 tokens (LLM-friendly)✅❌N/AN/A
20+ file formats✅⚠️ (media)⚠️ (text)❌
Free & open source✅⚠️Varies✅

Compliance

EU AI Act Article 50 takes effect August 2, 2026 — AI-generated content must carry transparency metadata (penalties up to EUR 35M / 7% of global turnover). Files stamped with AKF already carry it:

bash
akf audit report.docx --regulation eu_ai_act

Mappings for EU AI Act and NIST AI RMF.

Contributing

See CONTRIBUTING.md for development setup, testing, and PR process.

Free and Open — Forever

AKF is free and open source under the MIT license. The format specification will always be free. No feature will ever be gated behind a paid tier. AKF is a standard, and standards must be free to be universal.

License

MIT — use it everywhere, embed it in everything.

将 AKF MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 AKF 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 AKF 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 AKF MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "akf": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 AKF MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 AKF MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 AKF 帮我完成这项任务吗?
AKF
当然。我已阅读。
以下是我使用 AKF 得到的结果。

常见问题

AKF MCP 服务器有什么用途?

AKF 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 AKF MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 AKF,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 AKF MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 AKF 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 AKF MCP 连接到 TypingMind?

AKF 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

AKF MCP 在 TypingMind 中提供哪些工具?

AKF 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 AKF MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 AKF 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇