pythia-knowledge 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pythia_knowledge-1.0.0/.gitattributes +2 -0
- pythia_knowledge-1.0.0/.github/workflows/release.yml +126 -0
- pythia_knowledge-1.0.0/.github/workflows/tests.yml +31 -0
- pythia_knowledge-1.0.0/.gitignore +10 -0
- pythia_knowledge-1.0.0/.python-version +1 -0
- pythia_knowledge-1.0.0/CHANGELOG.md +10 -0
- pythia_knowledge-1.0.0/CLAUDE.md +31 -0
- pythia_knowledge-1.0.0/CONTRIBUTING.md +45 -0
- pythia_knowledge-1.0.0/LICENSE +21 -0
- pythia_knowledge-1.0.0/PKG-INFO +197 -0
- pythia_knowledge-1.0.0/README.md +162 -0
- pythia_knowledge-1.0.0/SECURITY.md +16 -0
- pythia_knowledge-1.0.0/assets/banner.svg +54 -0
- pythia_knowledge-1.0.0/assets/how-it-works.svg +120 -0
- pythia_knowledge-1.0.0/docker-compose.yml +15 -0
- pythia_knowledge-1.0.0/docs/architecture.md +236 -0
- pythia_knowledge-1.0.0/docs/decisions.md +144 -0
- pythia_knowledge-1.0.0/docs/design-rationale.md +137 -0
- pythia_knowledge-1.0.0/docs/known-issues.md +71 -0
- pythia_knowledge-1.0.0/docs/measuring-value.md +175 -0
- pythia_knowledge-1.0.0/pyproject.toml +62 -0
- pythia_knowledge-1.0.0/src/pythia/__init__.py +3 -0
- pythia_knowledge-1.0.0/src/pythia/cli.py +246 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/__init__.py +0 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/claude_code.py +467 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/common.py +99 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/confluence.py +803 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/github.py +444 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/incident_io.py +365 -0
- pythia_knowledge-1.0.0/src/pythia/connectors/slack.py +674 -0
- pythia_knowledge-1.0.0/src/pythia/consumer.py +268 -0
- pythia_knowledge-1.0.0/src/pythia/daemon.py +650 -0
- pythia_knowledge-1.0.0/src/pythia/db.py +80 -0
- pythia_knowledge-1.0.0/src/pythia/embed.py +39 -0
- pythia_knowledge-1.0.0/src/pythia/events.py +339 -0
- pythia_knowledge-1.0.0/src/pythia/evolution.py +392 -0
- pythia_knowledge-1.0.0/src/pythia/ids.py +12 -0
- pythia_knowledge-1.0.0/src/pythia/jobs.py +103 -0
- pythia_knowledge-1.0.0/src/pythia/knowledge.py +494 -0
- pythia_knowledge-1.0.0/src/pythia/llm/__init__.py +0 -0
- pythia_knowledge-1.0.0/src/pythia/llm/client.py +328 -0
- pythia_knowledge-1.0.0/src/pythia/mcp_server.py +73 -0
- pythia_knowledge-1.0.0/src/pythia/migrations/001_schema.sql +536 -0
- pythia_knowledge-1.0.0/src/pythia/migrations/__init__.py +0 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/__init__.py +0 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/adjudicate.py +297 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/batch.py +254 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/correct.py +227 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/derive.py +317 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/live.py +149 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/process.py +472 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/prompts.py +260 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/reconcile.py +168 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/schemas.py +154 -0
- pythia_knowledge-1.0.0/src/pythia/pipeline/sweep.py +155 -0
- pythia_knowledge-1.0.0/src/pythia/quality.py +359 -0
- pythia_knowledge-1.0.0/src/pythia/reexplain.py +248 -0
- pythia_knowledge-1.0.0/src/pythia/retrieval.py +137 -0
- pythia_knowledge-1.0.0/src/pythia/services.py +41 -0
- pythia_knowledge-1.0.0/src/pythia/settings.py +194 -0
- pythia_knowledge-1.0.0/src/pythia/usage.py +135 -0
- pythia_knowledge-1.0.0/src/pythia/value.py +265 -0
- pythia_knowledge-1.0.0/src/pythia/vault.py +31 -0
- pythia_knowledge-1.0.0/src/pythia/web/__init__.py +0 -0
- pythia_knowledge-1.0.0/src/pythia/web/app.py +779 -0
- pythia_knowledge-1.0.0/src/pythia/web/graph.py +167 -0
- pythia_knowledge-1.0.0/src/pythia/web/processing.py +131 -0
- pythia_knowledge-1.0.0/src/pythia/web/static/explore.js +242 -0
- pythia_knowledge-1.0.0/src/pythia/web/static/style.css +120 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/_now.html +25 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/base.html +30 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/config.html +231 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/costs.html +30 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/evolution.html +153 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/explore.html +36 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/label.html +22 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/quality.html +141 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/sources.html +249 -0
- pythia_knowledge-1.0.0/src/pythia/web/templates/usage.html +33 -0
- pythia_knowledge-1.0.0/tests/__init__.py +0 -0
- pythia_knowledge-1.0.0/tests/conftest.py +143 -0
- pythia_knowledge-1.0.0/tests/helpers.py +103 -0
- pythia_knowledge-1.0.0/tests/test_backfill_batch.py +167 -0
- pythia_knowledge-1.0.0/tests/test_chats.py +149 -0
- pythia_knowledge-1.0.0/tests/test_confluence.py +322 -0
- pythia_knowledge-1.0.0/tests/test_confluence_sweep_edge_cases.py +309 -0
- pythia_knowledge-1.0.0/tests/test_connector.py +126 -0
- pythia_knowledge-1.0.0/tests/test_core_edge_cases.py +184 -0
- pythia_knowledge-1.0.0/tests/test_events.py +59 -0
- pythia_knowledge-1.0.0/tests/test_evolution.py +186 -0
- pythia_knowledge-1.0.0/tests/test_github_catalog.py +716 -0
- pythia_knowledge-1.0.0/tests/test_golden_questions.py +103 -0
- pythia_knowledge-1.0.0/tests/test_narratives_incremental.py +102 -0
- pythia_knowledge-1.0.0/tests/test_operation.py +428 -0
- pythia_knowledge-1.0.0/tests/test_pipeline.py +420 -0
- pythia_knowledge-1.0.0/tests/test_reexplain.py +89 -0
- pythia_knowledge-1.0.0/tests/test_regressions.py +106 -0
- pythia_knowledge-1.0.0/tests/test_slack.py +598 -0
- pythia_knowledge-1.0.0/tests/test_sweep.py +175 -0
- pythia_knowledge-1.0.0/tests/test_value.py +82 -0
- pythia_knowledge-1.0.0/uv.lock +1728 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Release: tag vX.Y.Z -> build wheel/sdist -> smoke test -> GitHub Release -> TestPyPI -> PyPI
|
|
2
|
+
#
|
|
3
|
+
# One-time setup (Trusted Publishing, no API tokens):
|
|
4
|
+
# 1. GitHub Environments `testpypi` and `pypi` (optional required reviewers on `pypi`).
|
|
5
|
+
# 2. Pending publishers on TestPyPI and PyPI for project `pythia-knowledge`,
|
|
6
|
+
# owner `caribeedu`, repository `pythia`, workflow `release.yml`,
|
|
7
|
+
# with the environment names above.
|
|
8
|
+
name: release
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
tags:
|
|
13
|
+
- "v*.*.*"
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build-release:
|
|
21
|
+
name: build, smoke test, GitHub Release
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
permissions:
|
|
24
|
+
contents: write
|
|
25
|
+
outputs:
|
|
26
|
+
version: ${{ steps.meta.outputs.version }}
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.13"
|
|
33
|
+
|
|
34
|
+
- name: Check that the tag matches the package version
|
|
35
|
+
id: meta
|
|
36
|
+
run: |
|
|
37
|
+
set -euo pipefail
|
|
38
|
+
VERSION=$(python -c "import re; print(re.search(r'__version__ = \"([^\"]+)\"', open('src/pythia/__init__.py').read()).group(1))")
|
|
39
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
40
|
+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
|
|
41
|
+
TAG="${GITHUB_REF_NAME#v}"
|
|
42
|
+
if [[ "$TAG" != "$VERSION" ]]; then
|
|
43
|
+
echo "::error::tag v$TAG does not match the package version $VERSION"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
fi
|
|
47
|
+
echo "Building pythia-knowledge==$VERSION"
|
|
48
|
+
|
|
49
|
+
- name: Build sdist and wheel
|
|
50
|
+
run: |
|
|
51
|
+
pip install build
|
|
52
|
+
python -m build
|
|
53
|
+
|
|
54
|
+
- name: Smoke test the wheel
|
|
55
|
+
run: |
|
|
56
|
+
set -euo pipefail
|
|
57
|
+
python -m venv /tmp/smoke
|
|
58
|
+
/tmp/smoke/bin/pip install dist/pythia_knowledge-*.whl
|
|
59
|
+
/tmp/smoke/bin/pythia --version | grep "${{ steps.meta.outputs.version }}"
|
|
60
|
+
|
|
61
|
+
- name: Extract release notes from the changelog
|
|
62
|
+
env:
|
|
63
|
+
VERSION: ${{ steps.meta.outputs.version }}
|
|
64
|
+
run: |
|
|
65
|
+
python - <<'PY'
|
|
66
|
+
import os
|
|
67
|
+
from pathlib import Path
|
|
68
|
+
version = os.environ["VERSION"]
|
|
69
|
+
lines = Path("CHANGELOG.md").read_text(encoding="utf-8").splitlines()
|
|
70
|
+
start = next((i for i, l in enumerate(lines) if l.startswith(f"## v{version}")), None)
|
|
71
|
+
if start is None:
|
|
72
|
+
body = f"Release v{version}."
|
|
73
|
+
else:
|
|
74
|
+
end = next((j for j in range(start + 1, len(lines)) if lines[j].startswith("## v")), len(lines))
|
|
75
|
+
body = "\n".join(lines[start + 1:end]).strip()
|
|
76
|
+
Path("release_notes.md").write_text(body + "\n", encoding="utf-8")
|
|
77
|
+
PY
|
|
78
|
+
|
|
79
|
+
- name: Upload the distributions
|
|
80
|
+
uses: actions/upload-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
name: python-package-distributions
|
|
83
|
+
path: dist/
|
|
84
|
+
|
|
85
|
+
- name: Create the GitHub Release
|
|
86
|
+
if: github.event_name == 'push' && github.ref_type == 'tag'
|
|
87
|
+
uses: softprops/action-gh-release@v2
|
|
88
|
+
with:
|
|
89
|
+
files: dist/*
|
|
90
|
+
body_path: release_notes.md
|
|
91
|
+
fail_on_unmatched_files: true
|
|
92
|
+
env:
|
|
93
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
94
|
+
|
|
95
|
+
publish-testpypi:
|
|
96
|
+
name: publish to TestPyPI
|
|
97
|
+
needs: build-release
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
environment: testpypi
|
|
100
|
+
permissions:
|
|
101
|
+
id-token: write
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/download-artifact@v4
|
|
104
|
+
with:
|
|
105
|
+
name: python-package-distributions
|
|
106
|
+
path: dist/
|
|
107
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
108
|
+
with:
|
|
109
|
+
repository-url: https://test.pypi.org/legacy/
|
|
110
|
+
packages-dir: dist/
|
|
111
|
+
|
|
112
|
+
publish-pypi:
|
|
113
|
+
name: publish to PyPI
|
|
114
|
+
needs: [build-release, publish-testpypi]
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
environment: pypi
|
|
117
|
+
permissions:
|
|
118
|
+
id-token: write
|
|
119
|
+
steps:
|
|
120
|
+
- uses: actions/download-artifact@v4
|
|
121
|
+
with:
|
|
122
|
+
name: python-package-distributions
|
|
123
|
+
path: dist/
|
|
124
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
125
|
+
with:
|
|
126
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pytest:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
services:
|
|
12
|
+
postgres:
|
|
13
|
+
image: pgvector/pgvector:pg17
|
|
14
|
+
env:
|
|
15
|
+
POSTGRES_USER: pythia
|
|
16
|
+
POSTGRES_PASSWORD: pythia
|
|
17
|
+
POSTGRES_DB: pythia_test
|
|
18
|
+
ports:
|
|
19
|
+
- 5432:5432
|
|
20
|
+
options: >-
|
|
21
|
+
--health-cmd "pg_isready -U pythia"
|
|
22
|
+
--health-interval 5s
|
|
23
|
+
--health-timeout 5s
|
|
24
|
+
--health-retries 10
|
|
25
|
+
env:
|
|
26
|
+
PYTHIA_TEST_DATABASE_URL: postgresql://pythia:pythia@127.0.0.1:5432/pythia_test
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: astral-sh/setup-uv@v5
|
|
30
|
+
- run: uv sync --frozen
|
|
31
|
+
- run: uv run python -m pytest -q
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v1.0.0
|
|
4
|
+
|
|
5
|
+
First stable release.
|
|
6
|
+
|
|
7
|
+
- Ingests Claude Code sessions, GitHub pull requests, Slack, Confluence and the incident.io catalog into a base of atomic claims with provenance and time.
|
|
8
|
+
- Resolves entities and conflicts with an LLM, with reversible merges and verdicts, and a periodic drift sweep.
|
|
9
|
+
- Delivers knowledge through a hook push and five MCP tools.
|
|
10
|
+
- A web interface (Evolution, Explore, Sources, Usage, Costs, Quality, Config), a cost ledger with a monthly cap, and golden questions with a plain-search baseline.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Pythia — instructions for Claude
|
|
2
|
+
|
|
3
|
+
Before proposing or changing anything, read in this order:
|
|
4
|
+
|
|
5
|
+
1. [docs/design-rationale.md](docs/design-rationale.md): why the project is the way it is, and the principles.
|
|
6
|
+
2. [docs/architecture.md](docs/architecture.md): the architecture.
|
|
7
|
+
3. [docs/decisions.md](docs/decisions.md): decisions D1–D22 and how each area applies them.
|
|
8
|
+
4. [docs/known-issues.md](docs/known-issues.md), [docs/measuring-value.md](docs/measuring-value.md).
|
|
9
|
+
|
|
10
|
+
## Non-negotiable rules
|
|
11
|
+
|
|
12
|
+
- Judgment, analysis and context are **always LLM**. Determinism only for plumbing (I/O, cursors, hashes, ACLs, watermarks, cascade, queues, cache, budget). No regex or heuristics for meaning.
|
|
13
|
+
- **No LLM, no function.** No fallback. Only raw ingestion and reading what was already concluded continue, with a notice.
|
|
14
|
+
- **No human approval gates.** Truth is correctable: the owner's corrections have maximum authority.
|
|
15
|
+
- **Rich internal agents, lean external interface**: 5 MCP tools plus the push.
|
|
16
|
+
- An edit retracts the previous version; a deletion really erases, including derived text.
|
|
17
|
+
|
|
18
|
+
## How to work here
|
|
19
|
+
|
|
20
|
+
- Changed a prompt or schema? Bump `pipeline/prompts.py:VERSION`; the golden questions run on their own.
|
|
21
|
+
- New decisions go to `docs/decisions.md`.
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
.venv/bin/pythia start
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
.venv/bin/python -m pytest -q
|
|
31
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in Pythia. Before proposing a change, read [docs/design-rationale.md](docs/design-rationale.md): the project has a few non-negotiable principles, and changes that break them will not be merged.
|
|
4
|
+
|
|
5
|
+
## Principles in short
|
|
6
|
+
|
|
7
|
+
- Judgment, analysis and context are always done by an LLM. Determinism is for plumbing only (I/O, cursors, hashes, ACLs, watermarks, cascade, queues, cache, budget). No regex or heuristics for meaning.
|
|
8
|
+
- No LLM, no function. No fallback that pretends otherwise.
|
|
9
|
+
- No human approval gates. Truth is correctable, and the owner's corrections win.
|
|
10
|
+
- Rich agents inside, a lean external interface (five MCP tools plus the push).
|
|
11
|
+
- An edit retracts the previous version; a deletion erases everything derived from it.
|
|
12
|
+
|
|
13
|
+
## Development setup
|
|
14
|
+
|
|
15
|
+
You need Python 3.13 or 3.14, [uv](https://docs.astral.sh/uv/) and Docker.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uv sync
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
docker compose up -d
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
docker exec pythia-db psql -U pythia -c "create database pythia_test"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
uv run python -m pytest -q
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The tests use a real Postgres, a fake LLM and a fake embedder, so they need no API key and cost nothing. Set `PYTHIA_TEST_DATABASE_URL` to use another database.
|
|
34
|
+
|
|
35
|
+
## Pull requests
|
|
36
|
+
|
|
37
|
+
- Keep a change focused, and add or update tests. Bug fixes should come with a regression test.
|
|
38
|
+
- If you change a prompt or a schema, bump `VERSION` in `src/pythia/pipeline/prompts.py`; the golden questions run on their own.
|
|
39
|
+
- If you touch deletion or editing, make sure derived text also goes away, and test `rebuild`.
|
|
40
|
+
- Record a new design decision in [docs/decisions.md](docs/decisions.md).
|
|
41
|
+
- Write code, comments and documentation in English.
|
|
42
|
+
|
|
43
|
+
## Reporting problems
|
|
44
|
+
|
|
45
|
+
Open an issue with what you did, what you expected and what happened. For security problems, follow [SECURITY.md](SECURITY.md) instead.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Edu Caribé
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pythia-knowledge
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Personal knowledge oracle
|
|
5
|
+
Project-URL: Homepage, https://github.com/caribeedu/pythia
|
|
6
|
+
Project-URL: Documentation, https://github.com/caribeedu/pythia/tree/main/docs
|
|
7
|
+
Project-URL: Issues, https://github.com/caribeedu/pythia/issues
|
|
8
|
+
Author: Edu Caribé
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: claude,knowledge-base,knowledge-graph,llm,mcp,memory
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Environment :: Web Environment
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: <3.15,>=3.13
|
|
23
|
+
Requires-Dist: anthropic>=0.70
|
|
24
|
+
Requires-Dist: fastapi>=0.115
|
|
25
|
+
Requires-Dist: fastembed>=0.5
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Requires-Dist: jinja2>=3.1
|
|
28
|
+
Requires-Dist: keyring>=25
|
|
29
|
+
Requires-Dist: mcp>=1.10
|
|
30
|
+
Requires-Dist: pgvector>=0.3
|
|
31
|
+
Requires-Dist: psycopg[binary,pool]>=3.2
|
|
32
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
33
|
+
Requires-Dist: uvicorn[standard]>=0.30
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="https://raw.githubusercontent.com/caribeedu/pythia/main/assets/banner.svg" alt="Pythia — a personal knowledge oracle" width="100%">
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<a href="https://github.com/caribeedu/pythia/actions/workflows/tests.yml"><img src="https://github.com/caribeedu/pythia/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
|
42
|
+
<img src="https://img.shields.io/badge/python-3.13%20%7C%203.14-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.13 | 3.14">
|
|
43
|
+
<img src="https://img.shields.io/badge/MCP-5%20tools-c07a2c?style=flat-square" alt="MCP, 5 tools">
|
|
44
|
+
<a href="https://github.com/caribeedu/pythia/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-22c55e?style=flat-square" alt="MIT"></a>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
# Pythia
|
|
48
|
+
|
|
49
|
+
Pythia continuously reads the places where your work happens, keeps a base of atomic claims with provenance and time, detects when knowledge becomes outdated or contradictory, and delivers what matters to your LLMs, automatically through hooks (push) and on demand through MCP (pull).
|
|
50
|
+
|
|
51
|
+
It is the spiritual successor of [Twin](https://github.com/caribeedu/twin) and the goal is the same.
|
|
52
|
+
|
|
53
|
+
> [!IMPORTANT]
|
|
54
|
+
> **Need a knowledge oracle, or just an AI that truly sees you?** Pythia is for those who need to cross-reference complex contexts, and it spends a lot of tokens to do it.
|
|
55
|
+
> **[who-am-ai](https://github.com/caribeedu/who-am-ai)**, a leaner alternative, listens to what you say to your assistant, and how, and keeps one short profile it loads every time.
|
|
56
|
+
> It keeps only general, durable preferences, never one-off task details, in a file you can read, edit and veto. A fraction of the tokens. To stop repeating yourself, start there.
|
|
57
|
+
|
|
58
|
+
## Why
|
|
59
|
+
|
|
60
|
+
AI assistants forget. Each session starts blank, so you keep explaining how you write, who owns which system, what the team decided last week and what caused that bug. Product memories help inside one assistant; retrieval returns fragments without knowing which are still true. Pythia keeps *what is currently true*, where it came from, and what changed.
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
- **Claims, not documents.** The source of truth is the atomic claim (subject, attribute, value, validity, status, evidence). Pages and narratives are derivatives that cite claims, go stale only when a cited claim changes, and can be regenerated at any time.
|
|
65
|
+
- **Open-world entity resolution.** People, teams, systems and projects are resolved from context by an LLM, seeded by registries such as the incident.io catalog. Merge, split and relink are reversible events.
|
|
66
|
+
- **Conflict and drift handling.** New claims are confronted with what is already known. An adjudicator agent investigates, with live access to the sources (current file, CODEOWNERS, Slack thread, Confluence page), and records a reversible **verdict**: temporal supersession, real conflict, different scope, outdated source, duplicate. A periodic sweep looks for drift with no trigger.
|
|
67
|
+
- **You are the authority.** There are no approval queues. The system writes its result and you correct it afterwards; your corrections always win and become quality metrics and test examples.
|
|
68
|
+
- **Edits and deletions are respected.** An edit retracts the previous version; a deletion at the source erases the content *and* every derived text, including old page versions.
|
|
69
|
+
- **Small external interface.** Five MCP tools (`search`, `open`, `timeline`, `correct`, `define`) and a short push briefing whose text is always stored knowledge, never generated prose.
|
|
70
|
+
- **No LLM, no guessing.** Judgment is always done by an LLM; there are no regex or heuristic fallbacks. Without a key, network or budget, ingestion continues and reads serve what was already concluded, with a notice.
|
|
71
|
+
- **Measured.** Cost ledger and monthly cap, golden questions with a sealed half and a plain-search baseline, correction rate per role, and a method to measure avoided re-explanation ([docs/measuring-value.md](https://github.com/caribeedu/pythia/blob/main/docs/measuring-value.md)).
|
|
72
|
+
|
|
73
|
+
### Sources and consumers
|
|
74
|
+
|
|
75
|
+
| Sources | Consumers |
|
|
76
|
+
|---|---|
|
|
77
|
+
| Claude Code sessions (per chat, explicit allowlist) | Claude Code: hook push (`SessionStart`, `UserPromptSubmit`) |
|
|
78
|
+
| GitHub pull requests (diffs, reviews, comments) | Claude Code and any MCP client: pull |
|
|
79
|
+
| Slack channels, threads and DMs (user token, no bot) | |
|
|
80
|
+
| Confluence spaces and page trees, with comments | |
|
|
81
|
+
| incident.io catalog (entity seed) | |
|
|
82
|
+
|
|
83
|
+
Zoom is planned.
|
|
84
|
+
|
|
85
|
+
### The web interface
|
|
86
|
+
|
|
87
|
+
| Screen | What it shows |
|
|
88
|
+
|---|---|
|
|
89
|
+
| **Evolution** | What changed and why, newest first: one line per cause, with before/after of the claims, page diffs and per-attribute trajectories |
|
|
90
|
+
| **Explore** | Ego graph around any entity with a time slider; correct, relink, merge or retract from the side panel |
|
|
91
|
+
| **Sources** | The allowlist, connector state, backfill estimates and what is being processed right now |
|
|
92
|
+
| **Usage** | Exactly what was pushed to each chat and what each MCP call returned |
|
|
93
|
+
| **Costs** | Spend against the cap, by role, source and model |
|
|
94
|
+
| **Quality** | Correction rate, golden questions and baseline, detector precision, value metrics |
|
|
95
|
+
| **Config** | Models per role, budget, credentials (kept in the OS keychain), Claude Code integration |
|
|
96
|
+
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
<p align="center">
|
|
100
|
+
<img src="https://raw.githubusercontent.com/caribeedu/pythia/main/assets/how-it-works.svg" alt="How Pythia works: sources become evidence, mentions, entities and claims; conflicts become tensions and verdicts; claims feed pages, narratives and the map that serve the push hook and the MCP tools" width="100%">
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
A unit of a source (a settled thread, a merged PR, a chat delta, a page edit) goes through **triage → extraction → entity resolution → integration → adjudication (when needed) → regeneration of derivatives**, on a single Postgres job queue with separate lanes for I/O, cognition and derivation. State is event-sourced, so the base can answer both *what is true* and *what Pythia believed at time T*.
|
|
104
|
+
|
|
105
|
+
Details: [docs/architecture.md](https://github.com/caribeedu/pythia/blob/main/docs/architecture.md).
|
|
106
|
+
|
|
107
|
+
## Getting started
|
|
108
|
+
|
|
109
|
+
**Requirements:** Python 3.13 or 3.14, [uv](https://docs.astral.sh/uv/), Docker (Postgres 17 with pgvector) and an [Anthropic API key](https://console.anthropic.com/). Credentials are stored with the OS keychain (`keyring`); autostart at login is available on macOS.
|
|
110
|
+
|
|
111
|
+
Install it from PyPI (the package is `pythia-knowledge`; the command is `pythia`):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
uv tool install pythia-knowledge
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pythia start
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or run it from a source checkout with `uv sync` and `uv run pythia start`.
|
|
122
|
+
|
|
123
|
+
`start` brings up the database container if needed, then runs the daemon and the web server in the background. Open <http://127.0.0.1:7117> and:
|
|
124
|
+
|
|
125
|
+
1. **Config:** add your Anthropic API key, review the models per role and set the monthly cap.
|
|
126
|
+
2. **Sources:** turn on the Claude Code chats to read, and add repositories, Slack conversations or Confluence spaces. Each new source enters paused with a cost estimate for its backfill.
|
|
127
|
+
3. **Config → Claude Code integration:** copy the MCP command (pull) and the hooks snippet (push) into your Claude Code setup.
|
|
128
|
+
|
|
129
|
+
### Command line
|
|
130
|
+
|
|
131
|
+
The CLI only manages the process; everything else is configured on the web.
|
|
132
|
+
|
|
133
|
+
| Command | Does |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `pythia start` / `stop` / `status` | Start, stop or inspect the background process |
|
|
136
|
+
| `pythia run` | Run in the foreground |
|
|
137
|
+
| `pythia autostart` | Start at login (macOS LaunchAgent); `--off` undoes it |
|
|
138
|
+
|
|
139
|
+
Environment: `PYTHIA_HOME` (default `~/.pythia`: pid file and logs) and `PYTHIA_DATABASE_URL` (use your own Postgres instead of the container; it needs the `vector` extension).
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
Tests run against a real Postgres, a fake LLM and a fake embedder, so they are fast and cost nothing.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
docker compose up -d
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
docker exec pythia-db psql -U pythia -c "create database pythia_test"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
.venv/bin/python -m pytest -q
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
If you change a prompt or schema, bump `VERSION` in `src/pythia/pipeline/prompts.py`; the golden questions then run on their own.
|
|
158
|
+
|
|
159
|
+
### Repository layout
|
|
160
|
+
|
|
161
|
+
| Path | What |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `src/pythia/events.py` | Append-only event log, projections and `rebuild` |
|
|
164
|
+
| `src/pythia/knowledge.py` | Knowledge commands: claims, mentions, verdicts, cascade, tombstones |
|
|
165
|
+
| `src/pythia/connectors/` | Claude Code, GitHub, Slack, Confluence and incident.io |
|
|
166
|
+
| `src/pythia/pipeline/` | Triage, extraction, resolution, integration, adjudication, sweep, derivation, corrections |
|
|
167
|
+
| `src/pythia/llm/client.py` | Roles, structured output, agent loop, cost ledger, cap and halt |
|
|
168
|
+
| `src/pythia/consumer.py`, `mcp_server.py` | The five MCP tools and the push briefing |
|
|
169
|
+
| `src/pythia/web/` | FastAPI app, templates and the Explore graph |
|
|
170
|
+
| `src/pythia/daemon.py`, `jobs.py` | Job queue, lanes and scheduler |
|
|
171
|
+
| `src/pythia/migrations/` | Postgres schema |
|
|
172
|
+
|
|
173
|
+
## Documentation
|
|
174
|
+
|
|
175
|
+
| Document | About |
|
|
176
|
+
|---|---|
|
|
177
|
+
| [Architecture](https://github.com/caribeedu/pythia/blob/main/docs/architecture.md) | Knowledge model, entity resolution, conflicts, ingestion, consumption, stack |
|
|
178
|
+
| [Decisions](https://github.com/caribeedu/pythia/blob/main/docs/decisions.md) | Numbered core decisions (D1–D22) and how each area applies them |
|
|
179
|
+
| [Design rationale](https://github.com/caribeedu/pythia/blob/main/docs/design-rationale.md) | Why it is the way it is: principles, influences and what real use taught |
|
|
180
|
+
| [Measuring value](https://github.com/caribeedu/pythia/blob/main/docs/measuring-value.md) | Metrics, experiment design and results |
|
|
181
|
+
| [Known limitations](https://github.com/caribeedu/pythia/blob/main/docs/known-issues.md) | Open problems and their proposed fixes |
|
|
182
|
+
|
|
183
|
+
## Principles
|
|
184
|
+
|
|
185
|
+
1. Judgment is always an LLM; determinism is for plumbing only.
|
|
186
|
+
2. No LLM, no function, and no fallback that pretends otherwise.
|
|
187
|
+
3. A truth that is wrong but correctable beats a hypothesis waiting for approval.
|
|
188
|
+
4. Rich agents inside, a lean interface outside.
|
|
189
|
+
5. Derivatives are disposable; evidence, entities, claims, verdicts and human decisions are the only state that matters.
|
|
190
|
+
|
|
191
|
+
## Contributing and security
|
|
192
|
+
|
|
193
|
+
See [CONTRIBUTING.md](https://github.com/caribeedu/pythia/blob/main/CONTRIBUTING.md) before opening a pull request, and [SECURITY.md](https://github.com/caribeedu/pythia/blob/main/SECURITY.md) to report a vulnerability.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
[MIT](https://github.com/caribeedu/pythia/blob/main/LICENSE)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/caribeedu/pythia/main/assets/banner.svg" alt="Pythia — a personal knowledge oracle" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/caribeedu/pythia/actions/workflows/tests.yml"><img src="https://github.com/caribeedu/pythia/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
|
7
|
+
<img src="https://img.shields.io/badge/python-3.13%20%7C%203.14-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.13 | 3.14">
|
|
8
|
+
<img src="https://img.shields.io/badge/MCP-5%20tools-c07a2c?style=flat-square" alt="MCP, 5 tools">
|
|
9
|
+
<a href="https://github.com/caribeedu/pythia/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-22c55e?style=flat-square" alt="MIT"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
# Pythia
|
|
13
|
+
|
|
14
|
+
Pythia continuously reads the places where your work happens, keeps a base of atomic claims with provenance and time, detects when knowledge becomes outdated or contradictory, and delivers what matters to your LLMs, automatically through hooks (push) and on demand through MCP (pull).
|
|
15
|
+
|
|
16
|
+
It is the spiritual successor of [Twin](https://github.com/caribeedu/twin) and the goal is the same.
|
|
17
|
+
|
|
18
|
+
> [!IMPORTANT]
|
|
19
|
+
> **Need a knowledge oracle, or just an AI that truly sees you?** Pythia is for those who need to cross-reference complex contexts, and it spends a lot of tokens to do it.
|
|
20
|
+
> **[who-am-ai](https://github.com/caribeedu/who-am-ai)**, a leaner alternative, listens to what you say to your assistant, and how, and keeps one short profile it loads every time.
|
|
21
|
+
> It keeps only general, durable preferences, never one-off task details, in a file you can read, edit and veto. A fraction of the tokens. To stop repeating yourself, start there.
|
|
22
|
+
|
|
23
|
+
## Why
|
|
24
|
+
|
|
25
|
+
AI assistants forget. Each session starts blank, so you keep explaining how you write, who owns which system, what the team decided last week and what caused that bug. Product memories help inside one assistant; retrieval returns fragments without knowing which are still true. Pythia keeps *what is currently true*, where it came from, and what changed.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Claims, not documents.** The source of truth is the atomic claim (subject, attribute, value, validity, status, evidence). Pages and narratives are derivatives that cite claims, go stale only when a cited claim changes, and can be regenerated at any time.
|
|
30
|
+
- **Open-world entity resolution.** People, teams, systems and projects are resolved from context by an LLM, seeded by registries such as the incident.io catalog. Merge, split and relink are reversible events.
|
|
31
|
+
- **Conflict and drift handling.** New claims are confronted with what is already known. An adjudicator agent investigates, with live access to the sources (current file, CODEOWNERS, Slack thread, Confluence page), and records a reversible **verdict**: temporal supersession, real conflict, different scope, outdated source, duplicate. A periodic sweep looks for drift with no trigger.
|
|
32
|
+
- **You are the authority.** There are no approval queues. The system writes its result and you correct it afterwards; your corrections always win and become quality metrics and test examples.
|
|
33
|
+
- **Edits and deletions are respected.** An edit retracts the previous version; a deletion at the source erases the content *and* every derived text, including old page versions.
|
|
34
|
+
- **Small external interface.** Five MCP tools (`search`, `open`, `timeline`, `correct`, `define`) and a short push briefing whose text is always stored knowledge, never generated prose.
|
|
35
|
+
- **No LLM, no guessing.** Judgment is always done by an LLM; there are no regex or heuristic fallbacks. Without a key, network or budget, ingestion continues and reads serve what was already concluded, with a notice.
|
|
36
|
+
- **Measured.** Cost ledger and monthly cap, golden questions with a sealed half and a plain-search baseline, correction rate per role, and a method to measure avoided re-explanation ([docs/measuring-value.md](https://github.com/caribeedu/pythia/blob/main/docs/measuring-value.md)).
|
|
37
|
+
|
|
38
|
+
### Sources and consumers
|
|
39
|
+
|
|
40
|
+
| Sources | Consumers |
|
|
41
|
+
|---|---|
|
|
42
|
+
| Claude Code sessions (per chat, explicit allowlist) | Claude Code: hook push (`SessionStart`, `UserPromptSubmit`) |
|
|
43
|
+
| GitHub pull requests (diffs, reviews, comments) | Claude Code and any MCP client: pull |
|
|
44
|
+
| Slack channels, threads and DMs (user token, no bot) | |
|
|
45
|
+
| Confluence spaces and page trees, with comments | |
|
|
46
|
+
| incident.io catalog (entity seed) | |
|
|
47
|
+
|
|
48
|
+
Zoom is planned.
|
|
49
|
+
|
|
50
|
+
### The web interface
|
|
51
|
+
|
|
52
|
+
| Screen | What it shows |
|
|
53
|
+
|---|---|
|
|
54
|
+
| **Evolution** | What changed and why, newest first: one line per cause, with before/after of the claims, page diffs and per-attribute trajectories |
|
|
55
|
+
| **Explore** | Ego graph around any entity with a time slider; correct, relink, merge or retract from the side panel |
|
|
56
|
+
| **Sources** | The allowlist, connector state, backfill estimates and what is being processed right now |
|
|
57
|
+
| **Usage** | Exactly what was pushed to each chat and what each MCP call returned |
|
|
58
|
+
| **Costs** | Spend against the cap, by role, source and model |
|
|
59
|
+
| **Quality** | Correction rate, golden questions and baseline, detector precision, value metrics |
|
|
60
|
+
| **Config** | Models per role, budget, credentials (kept in the OS keychain), Claude Code integration |
|
|
61
|
+
|
|
62
|
+
## How it works
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<img src="https://raw.githubusercontent.com/caribeedu/pythia/main/assets/how-it-works.svg" alt="How Pythia works: sources become evidence, mentions, entities and claims; conflicts become tensions and verdicts; claims feed pages, narratives and the map that serve the push hook and the MCP tools" width="100%">
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
A unit of a source (a settled thread, a merged PR, a chat delta, a page edit) goes through **triage → extraction → entity resolution → integration → adjudication (when needed) → regeneration of derivatives**, on a single Postgres job queue with separate lanes for I/O, cognition and derivation. State is event-sourced, so the base can answer both *what is true* and *what Pythia believed at time T*.
|
|
69
|
+
|
|
70
|
+
Details: [docs/architecture.md](https://github.com/caribeedu/pythia/blob/main/docs/architecture.md).
|
|
71
|
+
|
|
72
|
+
## Getting started
|
|
73
|
+
|
|
74
|
+
**Requirements:** Python 3.13 or 3.14, [uv](https://docs.astral.sh/uv/), Docker (Postgres 17 with pgvector) and an [Anthropic API key](https://console.anthropic.com/). Credentials are stored with the OS keychain (`keyring`); autostart at login is available on macOS.
|
|
75
|
+
|
|
76
|
+
Install it from PyPI (the package is `pythia-knowledge`; the command is `pythia`):
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv tool install pythia-knowledge
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pythia start
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or run it from a source checkout with `uv sync` and `uv run pythia start`.
|
|
87
|
+
|
|
88
|
+
`start` brings up the database container if needed, then runs the daemon and the web server in the background. Open <http://127.0.0.1:7117> and:
|
|
89
|
+
|
|
90
|
+
1. **Config:** add your Anthropic API key, review the models per role and set the monthly cap.
|
|
91
|
+
2. **Sources:** turn on the Claude Code chats to read, and add repositories, Slack conversations or Confluence spaces. Each new source enters paused with a cost estimate for its backfill.
|
|
92
|
+
3. **Config → Claude Code integration:** copy the MCP command (pull) and the hooks snippet (push) into your Claude Code setup.
|
|
93
|
+
|
|
94
|
+
### Command line
|
|
95
|
+
|
|
96
|
+
The CLI only manages the process; everything else is configured on the web.
|
|
97
|
+
|
|
98
|
+
| Command | Does |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `pythia start` / `stop` / `status` | Start, stop or inspect the background process |
|
|
101
|
+
| `pythia run` | Run in the foreground |
|
|
102
|
+
| `pythia autostart` | Start at login (macOS LaunchAgent); `--off` undoes it |
|
|
103
|
+
|
|
104
|
+
Environment: `PYTHIA_HOME` (default `~/.pythia`: pid file and logs) and `PYTHIA_DATABASE_URL` (use your own Postgres instead of the container; it needs the `vector` extension).
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
Tests run against a real Postgres, a fake LLM and a fake embedder, so they are fast and cost nothing.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
docker compose up -d
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
docker exec pythia-db psql -U pythia -c "create database pythia_test"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
.venv/bin/python -m pytest -q
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
If you change a prompt or schema, bump `VERSION` in `src/pythia/pipeline/prompts.py`; the golden questions then run on their own.
|
|
123
|
+
|
|
124
|
+
### Repository layout
|
|
125
|
+
|
|
126
|
+
| Path | What |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `src/pythia/events.py` | Append-only event log, projections and `rebuild` |
|
|
129
|
+
| `src/pythia/knowledge.py` | Knowledge commands: claims, mentions, verdicts, cascade, tombstones |
|
|
130
|
+
| `src/pythia/connectors/` | Claude Code, GitHub, Slack, Confluence and incident.io |
|
|
131
|
+
| `src/pythia/pipeline/` | Triage, extraction, resolution, integration, adjudication, sweep, derivation, corrections |
|
|
132
|
+
| `src/pythia/llm/client.py` | Roles, structured output, agent loop, cost ledger, cap and halt |
|
|
133
|
+
| `src/pythia/consumer.py`, `mcp_server.py` | The five MCP tools and the push briefing |
|
|
134
|
+
| `src/pythia/web/` | FastAPI app, templates and the Explore graph |
|
|
135
|
+
| `src/pythia/daemon.py`, `jobs.py` | Job queue, lanes and scheduler |
|
|
136
|
+
| `src/pythia/migrations/` | Postgres schema |
|
|
137
|
+
|
|
138
|
+
## Documentation
|
|
139
|
+
|
|
140
|
+
| Document | About |
|
|
141
|
+
|---|---|
|
|
142
|
+
| [Architecture](https://github.com/caribeedu/pythia/blob/main/docs/architecture.md) | Knowledge model, entity resolution, conflicts, ingestion, consumption, stack |
|
|
143
|
+
| [Decisions](https://github.com/caribeedu/pythia/blob/main/docs/decisions.md) | Numbered core decisions (D1–D22) and how each area applies them |
|
|
144
|
+
| [Design rationale](https://github.com/caribeedu/pythia/blob/main/docs/design-rationale.md) | Why it is the way it is: principles, influences and what real use taught |
|
|
145
|
+
| [Measuring value](https://github.com/caribeedu/pythia/blob/main/docs/measuring-value.md) | Metrics, experiment design and results |
|
|
146
|
+
| [Known limitations](https://github.com/caribeedu/pythia/blob/main/docs/known-issues.md) | Open problems and their proposed fixes |
|
|
147
|
+
|
|
148
|
+
## Principles
|
|
149
|
+
|
|
150
|
+
1. Judgment is always an LLM; determinism is for plumbing only.
|
|
151
|
+
2. No LLM, no function, and no fallback that pretends otherwise.
|
|
152
|
+
3. A truth that is wrong but correctable beats a hypothesis waiting for approval.
|
|
153
|
+
4. Rich agents inside, a lean interface outside.
|
|
154
|
+
5. Derivatives are disposable; evidence, entities, claims, verdicts and human decisions are the only state that matters.
|
|
155
|
+
|
|
156
|
+
## Contributing and security
|
|
157
|
+
|
|
158
|
+
See [CONTRIBUTING.md](https://github.com/caribeedu/pythia/blob/main/CONTRIBUTING.md) before opening a pull request, and [SECURITY.md](https://github.com/caribeedu/pythia/blob/main/SECURITY.md) to report a vulnerability.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
[MIT](https://github.com/caribeedu/pythia/blob/main/LICENSE)
|