Metadata-Version: 2.4
Name: factq
Version: 0.1.0
Summary: Your LLM's Local Source of Truth — a local-first knowledge base and verification engine for hallucination prevention.
Project-URL: Homepage, https://factq.dev
Project-URL: Documentation, https://factq.dev
Project-URL: Repository, https://github.com/factq-dev/factq-cli
Project-URL: Issues, https://github.com/factq-dev/factq-cli/issues
Project-URL: Changelog, https://github.com/factq-dev/factq-cli/blob/main/CHANGELOG.md
Author: FactQ Team
License: Apache-2.0
Keywords: factuality,hallucination,knowledge-base,llm,mcp,rlm,verification
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: click>=8.1
Requires-Dist: pydantic>=2.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0
Provides-Extra: mcp
Requires-Dist: mcp>=1.0; extra == 'mcp'
Description-Content-Type: text/markdown

# factq

**Your LLM's Local Source of Truth**

A local-first knowledge base and verification engine that sits between you and your AI tools. It answers from proven knowledge first, validates through executable code when needed, and gets smarter with every query.

## Install

```bash
pip install factq
```

## Quick Start

```python
import factq

# Initialize from project root — auto-indexes docs/ folder
fq = factq.init(".")

# Query checks project docs first, then KB, then Deepthink
result = fq.query("What version of Pydantic does our project use?")
# result.source: 'docs' | 'kb' | 'deepthink'

# Save a verified finding to the project's docs/ folder
fq.save("docs/research/pydantic_v2_migration.md", result)
```

Or from the CLI:

```bash
factq init                                    # index current project
factq query "What is our database schema?"    # docs-first resolution
factq save docs/research/schema_notes.md      # commit a finding
```

## How It Works

```
Query → KB Lookup (docs/ folder, milliseconds)
  → Deepthink (LLM writes Python to verify, sandbox execution)
    → Commit (verified fact saved back to docs/, git-versioned)
```

1. **Docs-First Resolution** — Your project's `docs/` folder is the first source of truth
2. **Executable Verification** — When docs can't answer, factq writes and runs Python code to verify facts in a secure sandbox
3. **Self-Growing Knowledge** — Verified facts are saved back as markdown files, version-controlled in git
4. **MCP Server** — Runs as a local MCP server for Claude Code, Cursor, and Windsurf

## Why factq?

| | Traditional RAG | Cloud Search | **factq** |
|---|---|---|---|
| **Verification** | Text similarity | Citation links | Executable code proof |
| **Infrastructure** | 3-6 GB VRAM | Cloud API | Zero VRAM, ~28 MB |
| **Knowledge Persistence** | Ephemeral chunks | None | Git-versioned docs/ |
| **Offline** | Partial | No | **Fully offline** |
| **Gets Smarter Over Time** | No | No | **Yes** |

## Development

```bash
git clone https://github.com/factq-dev/factq-cli.git
cd factq-cli
uv sync
uv run pytest tests/ -v
```

## License

Apache-2.0
