kbforge 0.1.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.
- kbforge-0.1.0/.github/dependabot.yml +39 -0
- kbforge-0.1.0/.github/workflows/ci.yml +87 -0
- kbforge-0.1.0/.gitignore +11 -0
- kbforge-0.1.0/.pre-commit-config.yaml +15 -0
- kbforge-0.1.0/.python-version +1 -0
- kbforge-0.1.0/CHANGELOG.md +50 -0
- kbforge-0.1.0/LICENSE +21 -0
- kbforge-0.1.0/PKG-INFO +152 -0
- kbforge-0.1.0/README.md +119 -0
- kbforge-0.1.0/docs/architecture.md +662 -0
- kbforge-0.1.0/docs/context/knowledge-base-design.md +354 -0
- kbforge-0.1.0/docs/design/2026-07-18-agent-facing-artifact-contract-design.md +359 -0
- kbforge-0.1.0/docs/design/2026-07-18-datacontract-bridge-design.md +145 -0
- kbforge-0.1.0/docs/design/2026-07-19-agentic-ingest-design.md +296 -0
- kbforge-0.1.0/pyproject.toml +79 -0
- kbforge-0.1.0/src/kbforge/__init__.py +9 -0
- kbforge-0.1.0/src/kbforge/__main__.py +125 -0
- kbforge-0.1.0/src/kbforge/canonical.py +49 -0
- kbforge-0.1.0/src/kbforge/connectors/__init__.py +0 -0
- kbforge-0.1.0/src/kbforge/connectors/git_commits.py +150 -0
- kbforge-0.1.0/src/kbforge/connectors/local_files.py +175 -0
- kbforge-0.1.0/src/kbforge/hookspecs.py +68 -0
- kbforge-0.1.0/src/kbforge/mirror.py +60 -0
- kbforge-0.1.0/src/kbforge/models.py +121 -0
- kbforge-0.1.0/src/kbforge/pipeline.py +123 -0
- kbforge-0.1.0/src/kbforge/publishers/__init__.py +0 -0
- kbforge-0.1.0/src/kbforge/publishers/dry_run.py +46 -0
- kbforge-0.1.0/src/kbforge/py.typed +0 -0
- kbforge-0.1.0/src/kbforge/registry.py +34 -0
- kbforge-0.1.0/src/kbforge/synthesize.py +92 -0
- kbforge-0.1.0/src/kbforge/validate.py +229 -0
- kbforge-0.1.0/tests/test_canonical.py +41 -0
- kbforge-0.1.0/tests/test_cli.py +148 -0
- kbforge-0.1.0/tests/test_dry_run_publisher.py +26 -0
- kbforge-0.1.0/tests/test_git_commits_connector.py +182 -0
- kbforge-0.1.0/tests/test_import.py +5 -0
- kbforge-0.1.0/tests/test_ingest_models.py +54 -0
- kbforge-0.1.0/tests/test_local_files_connector.py +164 -0
- kbforge-0.1.0/tests/test_mirror.py +56 -0
- kbforge-0.1.0/tests/test_models.py +42 -0
- kbforge-0.1.0/tests/test_pipeline.py +126 -0
- kbforge-0.1.0/tests/test_strict_okf.py +44 -0
- kbforge-0.1.0/tests/test_synthesize.py +63 -0
- kbforge-0.1.0/tests/test_validate.py +214 -0
- kbforge-0.1.0/uv.lock +366 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "github-actions"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
day: "monday"
|
|
8
|
+
labels:
|
|
9
|
+
- "dependencies"
|
|
10
|
+
|
|
11
|
+
- package-ecosystem: "pip"
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "weekly"
|
|
15
|
+
day: "monday"
|
|
16
|
+
open-pull-requests-limit: 10
|
|
17
|
+
labels:
|
|
18
|
+
- "dependencies"
|
|
19
|
+
groups:
|
|
20
|
+
minor-and-patch:
|
|
21
|
+
update-types:
|
|
22
|
+
- "minor"
|
|
23
|
+
- "patch"
|
|
24
|
+
|
|
25
|
+
# The hook revs in .pre-commit-config.yaml are the only place ruff's and ty's
|
|
26
|
+
# versions are declared -- the lint job runs the hooks rather than the tools --
|
|
27
|
+
# so bumping a rev here moves CI and every developer's pre-commit in lockstep.
|
|
28
|
+
# Dependabot skips `local` hooks, which is why these must stay as real repos.
|
|
29
|
+
- package-ecosystem: "pre-commit"
|
|
30
|
+
directory: "/"
|
|
31
|
+
schedule:
|
|
32
|
+
interval: "weekly"
|
|
33
|
+
day: "monday"
|
|
34
|
+
labels:
|
|
35
|
+
- "dependencies"
|
|
36
|
+
groups:
|
|
37
|
+
hooks:
|
|
38
|
+
patterns:
|
|
39
|
+
- "*"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: CI and Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths-ignore:
|
|
7
|
+
- "*.md"
|
|
8
|
+
- "docs/**"
|
|
9
|
+
- "LICENSE"
|
|
10
|
+
- ".gitignore"
|
|
11
|
+
pull_request:
|
|
12
|
+
paths-ignore:
|
|
13
|
+
- "*.md"
|
|
14
|
+
- "docs/**"
|
|
15
|
+
- "LICENSE"
|
|
16
|
+
- ".gitignore"
|
|
17
|
+
release:
|
|
18
|
+
types: [created]
|
|
19
|
+
workflow_dispatch:
|
|
20
|
+
inputs:
|
|
21
|
+
run_publish:
|
|
22
|
+
description: "Set to true to run the publish job"
|
|
23
|
+
required: false
|
|
24
|
+
default: "false"
|
|
25
|
+
|
|
26
|
+
permissions: {}
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
lint:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
permissions:
|
|
32
|
+
contents: read
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
35
|
+
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
36
|
+
with:
|
|
37
|
+
enable-cache: true
|
|
38
|
+
cache-dependency-glob: "pyproject.toml"
|
|
39
|
+
- run: uv python install 3.13
|
|
40
|
+
# Not a lint step: `--frozen` fails if uv.lock has drifted from pyproject.
|
|
41
|
+
- run: uv sync --all-extras --dev --frozen
|
|
42
|
+
# Run the hooks themselves instead of re-invoking ruff and ty, so the revs
|
|
43
|
+
# in .pre-commit-config.yaml are the single source of truth for which tool
|
|
44
|
+
# versions run. A version named here too would be a copy Dependabot cannot
|
|
45
|
+
# see, and it would silently drift from the hook on the next bump.
|
|
46
|
+
- run: uvx prek run --all-files --show-diff-on-failure
|
|
47
|
+
|
|
48
|
+
test:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
permissions:
|
|
51
|
+
contents: read
|
|
52
|
+
strategy:
|
|
53
|
+
matrix:
|
|
54
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
57
|
+
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
58
|
+
with:
|
|
59
|
+
enable-cache: true
|
|
60
|
+
cache-dependency-glob: "pyproject.toml"
|
|
61
|
+
- run: uv python install ${{ matrix.python-version }}
|
|
62
|
+
- run: uv sync --all-extras --dev --frozen
|
|
63
|
+
- run: uv run pytest --cov=kbforge --cov-report=term-missing
|
|
64
|
+
|
|
65
|
+
security:
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
permissions:
|
|
68
|
+
contents: read
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
71
|
+
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
72
|
+
- run: uvx uv-secure uv.lock
|
|
73
|
+
|
|
74
|
+
publish:
|
|
75
|
+
needs: [lint, test, security]
|
|
76
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.run_publish == 'true')
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
permissions:
|
|
79
|
+
id-token: write
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
82
|
+
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
83
|
+
with:
|
|
84
|
+
enable-cache: true
|
|
85
|
+
- run: uv python install 3.13
|
|
86
|
+
- run: uv build --no-sources
|
|
87
|
+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
|
kbforge-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.15.21
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff-check
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
# The rev pins both the ty version and a compatible uv version. The hook runs
|
|
10
|
+
# `uv check` under the hood, so kbforge's own dependencies resolve for ty --
|
|
11
|
+
# a local `entry: ty check` hook cannot see them.
|
|
12
|
+
- repo: https://github.com/astral-sh/ty-pre-commit
|
|
13
|
+
rev: v0.0.59
|
|
14
|
+
hooks:
|
|
15
|
+
- id: ty
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-07-19
|
|
11
|
+
|
|
12
|
+
First release: a deterministic, credential-free walking skeleton of the kbforge
|
|
13
|
+
production protocol.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **Fixed pipeline** — `fetch → normalize → mirror → diff → scope → synthesize →
|
|
18
|
+
validate → publish`, run once by `kbforge run`. The order is not pluggable, and
|
|
19
|
+
neither are the two trust guarantees enforced in it: the **no-op rule** (a sync
|
|
20
|
+
that finds no change opens no merge request) and the **never-auto-merge rule**
|
|
21
|
+
(a publisher proposes; it never merges).
|
|
22
|
+
- **Canonicalization** with the §4.3 stability law — `normalize` is deterministic,
|
|
23
|
+
clock-free, and volatile-free, so identical input always yields identical content
|
|
24
|
+
hashes. A byte-different but content-identical re-save (CRLF flips, a BOM, a
|
|
25
|
+
re-export) is not a change.
|
|
26
|
+
- **Replay-safe mirror and read-only diff** — change is detected against a
|
|
27
|
+
core-owned mirror; the mirror advances only after a run fully succeeds. Absence
|
|
28
|
+
never implies a deletion.
|
|
29
|
+
- **Two built-in connectors**, both credential-free:
|
|
30
|
+
- `local_files` — a folder of markdown-with-frontmatter, with an additive
|
|
31
|
+
`ignore_globs` config and always-on defaults (`.venv`, `.git`, `node_modules`,
|
|
32
|
+
tool caches) so pointing at a repository root does not sweep in dependencies.
|
|
33
|
+
- `git_commits` — one concept per commit, with genuine incremental sync: the
|
|
34
|
+
cursor is the last-synced SHA, so a re-run fetches only `<last>..<ref>`.
|
|
35
|
+
- **§4.4 agent-facing artifact laws**, enforced as core validators at the `validate`
|
|
36
|
+
stage: facet well-formedness, link resolvability, anchor presence, and freshness
|
|
37
|
+
legibility, plus a projection↔files coherence check. Nothing non-conformant ships.
|
|
38
|
+
- **Stub synthesizer** — deterministic, no LLM; reshapes canonical documents into
|
|
39
|
+
OKF concepts and gives the validators real structure to check.
|
|
40
|
+
- **Dry-run publisher** — writes the proposed bundle to a local directory under a
|
|
41
|
+
source-named branch; never merges; idempotent.
|
|
42
|
+
- **Plugin system** on Pluggy with entry-point discovery: any installed package
|
|
43
|
+
advertising the `kbforge.connectors` or `kbforge.publishers` entry-point group is
|
|
44
|
+
discovered without editing kbforge.
|
|
45
|
+
- **CLI** — `kbforge list` shows available connectors; `kbforge run --connector NAME
|
|
46
|
+
--set KEY=VALUE ...` resolves the connector from the registry and takes YAML-typed
|
|
47
|
+
config, with no per-connector knowledge in the CLI.
|
|
48
|
+
|
|
49
|
+
[Unreleased]: https://github.com/flyersworder/kbforge/compare/v0.1.0...HEAD
|
|
50
|
+
[0.1.0]: https://github.com/flyersworder/kbforge/releases/tag/v0.1.0
|
kbforge-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Qing Ye
|
|
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.
|
kbforge-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kbforge
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Agent-first knowledge bases, forged from your systems of record
|
|
5
|
+
Project-URL: Homepage, https://github.com/flyersworder/kbforge
|
|
6
|
+
Project-URL: Repository, https://github.com/flyersworder/kbforge
|
|
7
|
+
Project-URL: Issues, https://github.com/flyersworder/kbforge/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/flyersworder/kbforge/blob/main/docs/architecture.md
|
|
9
|
+
Project-URL: Changelog, https://github.com/flyersworder/kbforge/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Qing <qingye779@gmail.com>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agent-governance,ai-agents,connectors,knowledge-base,mcp,okf,open-knowledge-format,pluggy,rag
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: System Administrators
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Documentation
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Requires-Dist: pluggy>=1.5
|
|
26
|
+
Requires-Dist: pydantic>=2.0
|
|
27
|
+
Requires-Dist: pyyaml>=6
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=9.0.3; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.15.10; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# kbforge
|
|
35
|
+
|
|
36
|
+
[](https://github.com/flyersworder/kbforge/actions/workflows/ci.yml)
|
|
37
|
+
[](https://www.python.org/downloads/)
|
|
38
|
+
[](https://opensource.org/licenses/MIT)
|
|
39
|
+
|
|
40
|
+
**Agent-first knowledge bases, forged from your systems of record.**
|
|
41
|
+
|
|
42
|
+
The [Open Knowledge Format](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
|
|
43
|
+
(OKF) v0.1 standardizes the *artifact at rest* — markdown concept files, frontmatter,
|
|
44
|
+
`index.md`, `log.md`. It says nothing about how those bundles get **produced**: how you
|
|
45
|
+
pull from a wiki or a CMDB, how you tell a real change from an export timestamp jittering,
|
|
46
|
+
how a claim stays traceable to its source, and how an update reaches `main` without a human
|
|
47
|
+
losing an afternoon to review.
|
|
48
|
+
|
|
49
|
+
`kbforge` is the missing half — the production protocol.
|
|
50
|
+
|
|
51
|
+
| Layer | Standardized by |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Artifact format | OKF v0.1 |
|
|
54
|
+
| **Production protocol** — connectors, canonicalization, diff, provenance, publish | **kbforge** |
|
|
55
|
+
| Serving protocol | MCP |
|
|
56
|
+
|
|
57
|
+
"Agent-first" is a *checkable* claim, not a downstream hope. kbforge stays a producer —
|
|
58
|
+
the agent connects over MCP, which kbforge doesn't own — but every publish is gated on
|
|
59
|
+
four **agent-facing artifact laws** (facet well-formedness, link resolvability, anchor
|
|
60
|
+
presence, freshness legibility), plus a projection↔files coherence check so nothing
|
|
61
|
+
ships unvalidated. That gate is what puts the frontmatter, links, and provenance an
|
|
62
|
+
agent's serving layer needs into the artifact. What each law enforces at full versus
|
|
63
|
+
reduced strength (and the paths to full strength) is spelled out honestly in
|
|
64
|
+
[architecture.md §4.4](docs/architecture.md#44-agent-facing-artifact-laws-the-emit-side)
|
|
65
|
+
and the [artifact-contract spec](docs/design/2026-07-18-agent-facing-artifact-contract-design.md) §5.1.
|
|
66
|
+
|
|
67
|
+
## Status
|
|
68
|
+
|
|
69
|
+
**Alpha — a working walking skeleton.** The deterministic pipeline runs end to end with
|
|
70
|
+
no credentials and no LLM: two built-in connectors (`local_files`, `git_commits`),
|
|
71
|
+
canonicalization with a stability law, a replay-safe mirror and diff, a stub synthesizer,
|
|
72
|
+
the §4.4 validator gate, and a dry-run publisher. Change detection, the no-op rule, and
|
|
73
|
+
incremental sync via a real cursor are exercised by the test suite.
|
|
74
|
+
|
|
75
|
+
Not built yet: a real LLM synthesizer (the current one copies source text verbatim), a
|
|
76
|
+
credentialed system-of-record connector, and a GitHub-PR publisher. See
|
|
77
|
+
[`docs/architecture.md`](docs/architecture.md) for the full map.
|
|
78
|
+
|
|
79
|
+
## Quickstart
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install kbforge
|
|
83
|
+
kbforge list # show available connectors
|
|
84
|
+
|
|
85
|
+
kbforge run \
|
|
86
|
+
--connector local_files \
|
|
87
|
+
--set path=./docs \
|
|
88
|
+
--mirror .kbforge/mirror --out .kbforge/out --state .kbforge/state
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Re-running with no source change is a no-op — no merge request is opened. Point
|
|
92
|
+
`--connector git_commits --set repo=.` at a git repository to sync commit history
|
|
93
|
+
incrementally instead. Config values are YAML-typed, so `--set max_commits=50` is an
|
|
94
|
+
integer and `--set 'ignore_globs=[drafts]'` is a list.
|
|
95
|
+
|
|
96
|
+
## Design stance
|
|
97
|
+
|
|
98
|
+
The core ships **zero credentialed connectors and zero CI logic.** The two built-in
|
|
99
|
+
connectors need no credentials and serve as references; real systems of record are
|
|
100
|
+
plugins, discovered through the `kbforge.connectors` (and `kbforge.publishers`)
|
|
101
|
+
entry-point group without editing kbforge — deployments are separate, private
|
|
102
|
+
repositories. The interface is the product.
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
# in a third-party package's pyproject.toml — discovered automatically once installed
|
|
106
|
+
[project.entry-points."kbforge.connectors"]
|
|
107
|
+
myservice = "my_package:connector"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The pipeline order — fetch → normalize → mirror → diff → scope → synthesize → validate →
|
|
111
|
+
publish — is deliberately **not** pluggable, and neither are the no-op rule or the
|
|
112
|
+
never-auto-merge rule. Those are the trust guarantees; making them pluggable would make
|
|
113
|
+
them optional. Plugins extend stages. They cannot reorder or remove them.
|
|
114
|
+
|
|
115
|
+
## Documentation
|
|
116
|
+
|
|
117
|
+
- [`docs/architecture.md`](docs/architecture.md) — package architecture, the Pluggy
|
|
118
|
+
hookspecs, the connector protocol and its canonicalization laws, the fixed pipeline, and
|
|
119
|
+
the conformance test kit.
|
|
120
|
+
- [`docs/context/knowledge-base-design.md`](docs/context/knowledge-base-design.md) — the
|
|
121
|
+
system kbforge was extracted from: an OKF knowledge base for application managers served
|
|
122
|
+
over MCP, including the security model and a literature review.
|
|
123
|
+
- [`docs/design/2026-07-18-agent-facing-artifact-contract-design.md`](docs/design/2026-07-18-agent-facing-artifact-contract-design.md)
|
|
124
|
+
— why the artifact contract exists and how the four emit-side laws are enforced.
|
|
125
|
+
- [`docs/design/2026-07-19-agentic-ingest-design.md`](docs/design/2026-07-19-agentic-ingest-design.md)
|
|
126
|
+
— the roadmap for agentic fetch, the refresh model, and KB bootstrap.
|
|
127
|
+
- [`docs/design/2026-07-18-datacontract-bridge-design.md`](docs/design/2026-07-18-datacontract-bridge-design.md)
|
|
128
|
+
— how kbforge bridges to `agentic-data-contracts` via the OKF bundle (future, cross-project).
|
|
129
|
+
- [`CHANGELOG.md`](CHANGELOG.md) — release history.
|
|
130
|
+
|
|
131
|
+
## Related projects
|
|
132
|
+
|
|
133
|
+
kbforge is one of three *contracts for agents*, split by seam:
|
|
134
|
+
|
|
135
|
+
- [**ai-agent-contracts**](https://github.com/flyersworder/agent-contracts) — the formal
|
|
136
|
+
spine: resource, temporal, and lifecycle contracts (the seven-tuple kbforge maps onto).
|
|
137
|
+
- [**agentic-data-contracts**](https://github.com/flyersworder/agentic-data-contracts) —
|
|
138
|
+
the *consumption* half for **structured** data: domain-driven governance enforced at
|
|
139
|
+
query time. kbforge is the *production* half for **unstructured** knowledge; both
|
|
140
|
+
independently converged on making freshness legible to the agent.
|
|
141
|
+
|
|
142
|
+
## Development
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
uv sync --all-extras --dev # create the venv and install
|
|
146
|
+
prek install # ruff + ty on every commit
|
|
147
|
+
uv run pytest
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT
|
kbforge-0.1.0/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# kbforge
|
|
2
|
+
|
|
3
|
+
[](https://github.com/flyersworder/kbforge/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
**Agent-first knowledge bases, forged from your systems of record.**
|
|
8
|
+
|
|
9
|
+
The [Open Knowledge Format](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
|
|
10
|
+
(OKF) v0.1 standardizes the *artifact at rest* — markdown concept files, frontmatter,
|
|
11
|
+
`index.md`, `log.md`. It says nothing about how those bundles get **produced**: how you
|
|
12
|
+
pull from a wiki or a CMDB, how you tell a real change from an export timestamp jittering,
|
|
13
|
+
how a claim stays traceable to its source, and how an update reaches `main` without a human
|
|
14
|
+
losing an afternoon to review.
|
|
15
|
+
|
|
16
|
+
`kbforge` is the missing half — the production protocol.
|
|
17
|
+
|
|
18
|
+
| Layer | Standardized by |
|
|
19
|
+
|---|---|
|
|
20
|
+
| Artifact format | OKF v0.1 |
|
|
21
|
+
| **Production protocol** — connectors, canonicalization, diff, provenance, publish | **kbforge** |
|
|
22
|
+
| Serving protocol | MCP |
|
|
23
|
+
|
|
24
|
+
"Agent-first" is a *checkable* claim, not a downstream hope. kbforge stays a producer —
|
|
25
|
+
the agent connects over MCP, which kbforge doesn't own — but every publish is gated on
|
|
26
|
+
four **agent-facing artifact laws** (facet well-formedness, link resolvability, anchor
|
|
27
|
+
presence, freshness legibility), plus a projection↔files coherence check so nothing
|
|
28
|
+
ships unvalidated. That gate is what puts the frontmatter, links, and provenance an
|
|
29
|
+
agent's serving layer needs into the artifact. What each law enforces at full versus
|
|
30
|
+
reduced strength (and the paths to full strength) is spelled out honestly in
|
|
31
|
+
[architecture.md §4.4](docs/architecture.md#44-agent-facing-artifact-laws-the-emit-side)
|
|
32
|
+
and the [artifact-contract spec](docs/design/2026-07-18-agent-facing-artifact-contract-design.md) §5.1.
|
|
33
|
+
|
|
34
|
+
## Status
|
|
35
|
+
|
|
36
|
+
**Alpha — a working walking skeleton.** The deterministic pipeline runs end to end with
|
|
37
|
+
no credentials and no LLM: two built-in connectors (`local_files`, `git_commits`),
|
|
38
|
+
canonicalization with a stability law, a replay-safe mirror and diff, a stub synthesizer,
|
|
39
|
+
the §4.4 validator gate, and a dry-run publisher. Change detection, the no-op rule, and
|
|
40
|
+
incremental sync via a real cursor are exercised by the test suite.
|
|
41
|
+
|
|
42
|
+
Not built yet: a real LLM synthesizer (the current one copies source text verbatim), a
|
|
43
|
+
credentialed system-of-record connector, and a GitHub-PR publisher. See
|
|
44
|
+
[`docs/architecture.md`](docs/architecture.md) for the full map.
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install kbforge
|
|
50
|
+
kbforge list # show available connectors
|
|
51
|
+
|
|
52
|
+
kbforge run \
|
|
53
|
+
--connector local_files \
|
|
54
|
+
--set path=./docs \
|
|
55
|
+
--mirror .kbforge/mirror --out .kbforge/out --state .kbforge/state
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Re-running with no source change is a no-op — no merge request is opened. Point
|
|
59
|
+
`--connector git_commits --set repo=.` at a git repository to sync commit history
|
|
60
|
+
incrementally instead. Config values are YAML-typed, so `--set max_commits=50` is an
|
|
61
|
+
integer and `--set 'ignore_globs=[drafts]'` is a list.
|
|
62
|
+
|
|
63
|
+
## Design stance
|
|
64
|
+
|
|
65
|
+
The core ships **zero credentialed connectors and zero CI logic.** The two built-in
|
|
66
|
+
connectors need no credentials and serve as references; real systems of record are
|
|
67
|
+
plugins, discovered through the `kbforge.connectors` (and `kbforge.publishers`)
|
|
68
|
+
entry-point group without editing kbforge — deployments are separate, private
|
|
69
|
+
repositories. The interface is the product.
|
|
70
|
+
|
|
71
|
+
```toml
|
|
72
|
+
# in a third-party package's pyproject.toml — discovered automatically once installed
|
|
73
|
+
[project.entry-points."kbforge.connectors"]
|
|
74
|
+
myservice = "my_package:connector"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The pipeline order — fetch → normalize → mirror → diff → scope → synthesize → validate →
|
|
78
|
+
publish — is deliberately **not** pluggable, and neither are the no-op rule or the
|
|
79
|
+
never-auto-merge rule. Those are the trust guarantees; making them pluggable would make
|
|
80
|
+
them optional. Plugins extend stages. They cannot reorder or remove them.
|
|
81
|
+
|
|
82
|
+
## Documentation
|
|
83
|
+
|
|
84
|
+
- [`docs/architecture.md`](docs/architecture.md) — package architecture, the Pluggy
|
|
85
|
+
hookspecs, the connector protocol and its canonicalization laws, the fixed pipeline, and
|
|
86
|
+
the conformance test kit.
|
|
87
|
+
- [`docs/context/knowledge-base-design.md`](docs/context/knowledge-base-design.md) — the
|
|
88
|
+
system kbforge was extracted from: an OKF knowledge base for application managers served
|
|
89
|
+
over MCP, including the security model and a literature review.
|
|
90
|
+
- [`docs/design/2026-07-18-agent-facing-artifact-contract-design.md`](docs/design/2026-07-18-agent-facing-artifact-contract-design.md)
|
|
91
|
+
— why the artifact contract exists and how the four emit-side laws are enforced.
|
|
92
|
+
- [`docs/design/2026-07-19-agentic-ingest-design.md`](docs/design/2026-07-19-agentic-ingest-design.md)
|
|
93
|
+
— the roadmap for agentic fetch, the refresh model, and KB bootstrap.
|
|
94
|
+
- [`docs/design/2026-07-18-datacontract-bridge-design.md`](docs/design/2026-07-18-datacontract-bridge-design.md)
|
|
95
|
+
— how kbforge bridges to `agentic-data-contracts` via the OKF bundle (future, cross-project).
|
|
96
|
+
- [`CHANGELOG.md`](CHANGELOG.md) — release history.
|
|
97
|
+
|
|
98
|
+
## Related projects
|
|
99
|
+
|
|
100
|
+
kbforge is one of three *contracts for agents*, split by seam:
|
|
101
|
+
|
|
102
|
+
- [**ai-agent-contracts**](https://github.com/flyersworder/agent-contracts) — the formal
|
|
103
|
+
spine: resource, temporal, and lifecycle contracts (the seven-tuple kbforge maps onto).
|
|
104
|
+
- [**agentic-data-contracts**](https://github.com/flyersworder/agentic-data-contracts) —
|
|
105
|
+
the *consumption* half for **structured** data: domain-driven governance enforced at
|
|
106
|
+
query time. kbforge is the *production* half for **unstructured** knowledge; both
|
|
107
|
+
independently converged on making freshness legible to the agent.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
uv sync --all-extras --dev # create the venv and install
|
|
113
|
+
prek install # ruff + ty on every commit
|
|
114
|
+
uv run pytest
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|