xrefkit 0.3.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.
- xrefkit-0.3.0/LICENSE +21 -0
- xrefkit-0.3.0/PKG-INFO +203 -0
- xrefkit-0.3.0/README.md +164 -0
- xrefkit-0.3.0/pyproject.toml +34 -0
- xrefkit-0.3.0/setup.cfg +4 -0
- xrefkit-0.3.0/tests/test_base_sync_ownership.py +123 -0
- xrefkit-0.3.0/tests/test_calibration_lint.py +41 -0
- xrefkit-0.3.0/tests/test_check_skill_knowledge_xids.py +407 -0
- xrefkit-0.3.0/tests/test_cli.py +1457 -0
- xrefkit-0.3.0/tests/test_collect_analyzer_sarif.py +48 -0
- xrefkit-0.3.0/tests/test_convert_to_xrefkit_skill.py +199 -0
- xrefkit-0.3.0/tests/test_cs_scope_probe.py +57 -0
- xrefkit-0.3.0/tests/test_csharp_commonality.py +120 -0
- xrefkit-0.3.0/tests/test_csharp_naming_profile.py +264 -0
- xrefkit-0.3.0/tests/test_ctx.py +68 -0
- xrefkit-0.3.0/tests/test_cutover_readiness.py +54 -0
- xrefkit-0.3.0/tests/test_dashboard.py +406 -0
- xrefkit-0.3.0/tests/test_error_policy_audit.py +100 -0
- xrefkit-0.3.0/tests/test_error_policy_locator.py +152 -0
- xrefkit-0.3.0/tests/test_fm_multiroot.py +114 -0
- xrefkit-0.3.0/tests/test_gate.py +166 -0
- xrefkit-0.3.0/tests/test_goal_desired_state.py +75 -0
- xrefkit-0.3.0/tests/test_knowledge_relations_validator.py +83 -0
- xrefkit-0.3.0/tests/test_ownership.py +91 -0
- xrefkit-0.3.0/tests/test_packmeta.py +168 -0
- xrefkit-0.3.0/tests/test_project_quality_baseline.py +51 -0
- xrefkit-0.3.0/tests/test_resource_provider.py +105 -0
- xrefkit-0.3.0/tests/test_runtime_contracts.py +114 -0
- xrefkit-0.3.0/tests/test_sarif_to_locator.py +220 -0
- xrefkit-0.3.0/tests/test_skill_runtime_audit.py +645 -0
- xrefkit-0.3.0/tests/test_skillmeta.py +686 -0
- xrefkit-0.3.0/tests/test_structure_catalog.py +79 -0
- xrefkit-0.3.0/tests/test_xref.py +310 -0
- xrefkit-0.3.0/tests/test_xrefkit_instance.py +46 -0
- xrefkit-0.3.0/tests/test_xrefkit_tools.py +42 -0
- xrefkit-0.3.0/tests/test_xrefkit_v2_discovery.py +191 -0
- xrefkit-0.3.0/tests/test_xrefkit_v2_models.py +271 -0
- xrefkit-0.3.0/tests/test_xrefkit_v2_pipeline.py +526 -0
- xrefkit-0.3.0/xrefkit/__init__.py +5 -0
- xrefkit-0.3.0/xrefkit/__main__.py +5 -0
- xrefkit-0.3.0/xrefkit/catalog_cli.py +57 -0
- xrefkit-0.3.0/xrefkit/cli.py +71 -0
- xrefkit-0.3.0/xrefkit/contracts.py +297 -0
- xrefkit-0.3.0/xrefkit/ctx.py +160 -0
- xrefkit-0.3.0/xrefkit/dashboard.py +1220 -0
- xrefkit-0.3.0/xrefkit/discovery.py +85 -0
- xrefkit-0.3.0/xrefkit/gate.py +428 -0
- xrefkit-0.3.0/xrefkit/goalstate.py +555 -0
- xrefkit-0.3.0/xrefkit/hashing.py +18 -0
- xrefkit-0.3.0/xrefkit/import_skill.py +469 -0
- xrefkit-0.3.0/xrefkit/instance.py +133 -0
- xrefkit-0.3.0/xrefkit/loaders.py +77 -0
- xrefkit-0.3.0/xrefkit/mcp/__init__.py +26 -0
- xrefkit-0.3.0/xrefkit/mcp/audit.py +168 -0
- xrefkit-0.3.0/xrefkit/mcp/bootstrap.py +337 -0
- xrefkit-0.3.0/xrefkit/mcp/catalog.py +2638 -0
- xrefkit-0.3.0/xrefkit/mcp/cli.py +173 -0
- xrefkit-0.3.0/xrefkit/mcp/client_cache.py +356 -0
- xrefkit-0.3.0/xrefkit/mcp/context_registry.py +277 -0
- xrefkit-0.3.0/xrefkit/mcp/contracts.py +243 -0
- xrefkit-0.3.0/xrefkit/mcp/dist.py +234 -0
- xrefkit-0.3.0/xrefkit/mcp/ownership.py +246 -0
- xrefkit-0.3.0/xrefkit/mcp/repository.py +217 -0
- xrefkit-0.3.0/xrefkit/mcp/schemas.py +349 -0
- xrefkit-0.3.0/xrefkit/mcp/server.py +773 -0
- xrefkit-0.3.0/xrefkit/mcp/startup_contract_pack.py +154 -0
- xrefkit-0.3.0/xrefkit/mcp_tools.py +47 -0
- xrefkit-0.3.0/xrefkit/models/__init__.py +41 -0
- xrefkit-0.3.0/xrefkit/models/common.py +185 -0
- xrefkit-0.3.0/xrefkit/models/effective_bundle.py +131 -0
- xrefkit-0.3.0/xrefkit/models/local_manifest.py +217 -0
- xrefkit-0.3.0/xrefkit/models/package_manifest.py +126 -0
- xrefkit-0.3.0/xrefkit/models/run_log.py +276 -0
- xrefkit-0.3.0/xrefkit/models/server_config.py +160 -0
- xrefkit-0.3.0/xrefkit/models/skill_definition.py +131 -0
- xrefkit-0.3.0/xrefkit/operations_cli.py +670 -0
- xrefkit-0.3.0/xrefkit/ownership.py +276 -0
- xrefkit-0.3.0/xrefkit/packmeta.py +289 -0
- xrefkit-0.3.0/xrefkit/registry.py +334 -0
- xrefkit-0.3.0/xrefkit/resolver.py +252 -0
- xrefkit-0.3.0/xrefkit/resource_provider.py +187 -0
- xrefkit-0.3.0/xrefkit/resources/base/contracts.json +178 -0
- xrefkit-0.3.0/xrefkit/resources/base/current.json +6 -0
- xrefkit-0.3.0/xrefkit/resources/base/generations/7a682a5272907354/contracts.json +178 -0
- xrefkit-0.3.0/xrefkit/resources/base/generations/7a682a5272907354/model_body.md +22 -0
- xrefkit-0.3.0/xrefkit/resources/base/generations/9929294385ccb7b0/contracts.json +178 -0
- xrefkit-0.3.0/xrefkit/resources/base/generations/9929294385ccb7b0/model_body.md +22 -0
- xrefkit-0.3.0/xrefkit/resources/base/model_body.md +22 -0
- xrefkit-0.3.0/xrefkit/runlog.py +45 -0
- xrefkit-0.3.0/xrefkit/skillmeta.py +1034 -0
- xrefkit-0.3.0/xrefkit/skillrun.py +2381 -0
- xrefkit-0.3.0/xrefkit/structure_catalog.py +199 -0
- xrefkit-0.3.0/xrefkit/tools/__init__.py +119 -0
- xrefkit-0.3.0/xrefkit/tools/__main__.py +4 -0
- xrefkit-0.3.0/xrefkit/v2_cli.py +130 -0
- xrefkit-0.3.0/xrefkit/workspace.py +117 -0
- xrefkit-0.3.0/xrefkit/xref.py +1048 -0
- xrefkit-0.3.0/xrefkit.egg-info/PKG-INFO +203 -0
- xrefkit-0.3.0/xrefkit.egg-info/SOURCES.txt +101 -0
- xrefkit-0.3.0/xrefkit.egg-info/dependency_links.txt +1 -0
- xrefkit-0.3.0/xrefkit.egg-info/entry_points.txt +2 -0
- xrefkit-0.3.0/xrefkit.egg-info/requires.txt +9 -0
- xrefkit-0.3.0/xrefkit.egg-info/top_level.txt +1 -0
xrefkit-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ritu
|
|
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.
|
xrefkit-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xrefkit
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Portable XID, Skill, Knowledge, workflow, and MCP runtime for XRefKit
|
|
5
|
+
Author: synthaicode
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Ritu
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: PyYAML<7,>=6.0.2
|
|
32
|
+
Requires-Dist: pydantic<3,>=2.0
|
|
33
|
+
Provides-Extra: mcp
|
|
34
|
+
Requires-Dist: mcp>=1.0.0; extra == "mcp"
|
|
35
|
+
Requires-Dist: uvicorn>=0.30; extra == "mcp"
|
|
36
|
+
Provides-Extra: test
|
|
37
|
+
Requires-Dist: pytest>=8.0.0; extra == "test"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# XRefKit
|
|
41
|
+
|
|
42
|
+
AI agents often stop halfway, guess missing context, or produce work that looks
|
|
43
|
+
plausible but cannot be reviewed or handed off.
|
|
44
|
+
|
|
45
|
+
XRefKit is a portable Python package and repository model for AI-assisted work
|
|
46
|
+
that must reproduce domain procedures and judgments.
|
|
47
|
+
|
|
48
|
+
It runs as its own control repository and helps AI agents:
|
|
49
|
+
|
|
50
|
+
- load the right knowledge before acting
|
|
51
|
+
- select reusable Skills
|
|
52
|
+
- record judgments and evidence
|
|
53
|
+
- preserve handoffs across humans, agents, and sessions
|
|
54
|
+
- close work only through explicit quality gates
|
|
55
|
+
|
|
56
|
+
The package provides XID resolution, compact runtime contracts, Skill execution,
|
|
57
|
+
catalog-first context loading, deterministic closure gates, client-side tools,
|
|
58
|
+
and a thin MCP adapter over the same rules.
|
|
59
|
+
|
|
60
|
+
▶️ Download the 2-minute overview: [Why XRefKit exists and how it helps AI teams use domain knowledge](https://raw.githubusercontent.com/synthaicode/XRefKit/main/readme.mp4)
|
|
61
|
+
|
|
62
|
+
## Security and API Keys
|
|
63
|
+
|
|
64
|
+
XRefKit does not require Claude, OpenAI, GitHub, or other provider API keys to explore the repository.
|
|
65
|
+
|
|
66
|
+
This repository is a governance and knowledge-operations framework for AI-assisted work. It does not ask users to paste API keys into the repository, issue trackers, prompts, or configuration files.
|
|
67
|
+
|
|
68
|
+
If you use XRefKit with an external AI agent such as Claude Code, Codex, or GitHub Copilot, authenticate that agent through the official provider mechanism outside this repository.
|
|
69
|
+
|
|
70
|
+
Do not commit secrets, API keys, access tokens, `.env` files, or provider credentials to this repository.
|
|
71
|
+
|
|
72
|
+
XRefKit does not include repository-managed Claude settings, hooks, MCP server auto-approval, or provider endpoint redirection.
|
|
73
|
+
|
|
74
|
+
Before running any AI agent in this repository, review agent startup files and tool settings. XRefKit treats repository-controlled agent configuration as part of the trust boundary.
|
|
75
|
+
|
|
76
|
+
## The Problem
|
|
77
|
+
|
|
78
|
+
Using AI for real work creates recurring operating problems:
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
- the AI can act from incomplete context or unsupported guesses
|
|
83
|
+
- procedures, domain facts, and judgment criteria get mixed together in prompts
|
|
84
|
+
- execution, checking, and handoff collapse into one opaque step
|
|
85
|
+
- work becomes hard to continue across agents, humans, or sessions
|
|
86
|
+
- outputs may lack evidence, closure discipline, or auditability
|
|
87
|
+
|
|
88
|
+
## What XRefKit Provides
|
|
89
|
+
|
|
90
|
+
XRefKit makes AI work explicit by separating:
|
|
91
|
+
|
|
92
|
+
- Skills: executable work units, each identified by a capability/tuning/responsibility triad and carrying its execution and check contract
|
|
93
|
+
- Knowledge: source-backed domain facts and local rules loaded only when needed
|
|
94
|
+
- Workflow protocol: the generic, deterministic per-Skill control (phases, verification, closure) that wraps every Skill run
|
|
95
|
+
- Semantic routing: selecting the right Skill for a goal from user intent and the Skill catalog
|
|
96
|
+
- Evidence: logs, judgments, concerns, and quality checks
|
|
97
|
+
- XIDs: stable references that survive file movement and restructuring so AI can load targeted context without treating the whole repository as one prompt
|
|
98
|
+
|
|
99
|
+
This separation prevents prompts, domain facts, execution steps, review criteria,
|
|
100
|
+
and handoff records from collapsing into one opaque instruction block.
|
|
101
|
+
|
|
102
|
+

|
|
103
|
+
|
|
104
|
+
## How It Works
|
|
105
|
+
|
|
106
|
+
1. Original materials are kept in `sources/`.
|
|
107
|
+
2. AI-readable knowledge is maintained in `knowledge/`.
|
|
108
|
+
3. Work is defined in `skills/` (executable procedure with a capability/tuning/responsibility identity) and `knowledge/`.
|
|
109
|
+
4. Agents are routed semantically to the right Skill and load only the relevant context.
|
|
110
|
+
5. Evidence and quality gates make incomplete or unsupported work visible.
|
|
111
|
+
|
|
112
|
+
## Quick Start
|
|
113
|
+
|
|
114
|
+
Install the package and initialize an instance:
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
python -m pip install -e .
|
|
118
|
+
xrefkit init
|
|
119
|
+
xrefkit --help
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Start the integrated MCP server over stdio:
|
|
123
|
+
|
|
124
|
+
```powershell
|
|
125
|
+
xrefkit mcp serve --repo . --transport stdio
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The server writes structured correlation events to
|
|
129
|
+
`work/mcp/xid_audit.jsonl` by default. After `xrefkit skill run` returns a
|
|
130
|
+
`run_id`, the client calls MCP `bind_skill_run` and executes the returned
|
|
131
|
+
`client_record_command` against the local `run_log`. Subsequent MCP Knowledge
|
|
132
|
+
searches and XID resolutions then share the same `run_id` as the client Skill
|
|
133
|
+
Run. The client separately records actual model-context loading and judgment
|
|
134
|
+
application with `xrefkit skill knowledge --action load|apply`.
|
|
135
|
+
|
|
136
|
+
XRefKit is designed to be driven by an AI agent. The agent first resolves the
|
|
137
|
+
startup contract XID, selects a Skill or source target from a compact catalog,
|
|
138
|
+
and expands only the selected body.
|
|
139
|
+
|
|
140
|
+
Here, `sources/` is the human drop point for original materials, existing Skill artifacts, rules, and examples that the AI will turn into repository-managed assets.
|
|
141
|
+
|
|
142
|
+
If you are migrating an existing Skill:
|
|
143
|
+
|
|
144
|
+
1. Place the source Skill or related source materials in `sources/`.
|
|
145
|
+
2. Ask the AI agent to migrate that Skill into the XRefKit repository model.
|
|
146
|
+
3. Have the migration process separate procedure, source-backed knowledge, and runtime structure as needed.
|
|
147
|
+
4. Review whether the migrated Skill is usable for the intended work.
|
|
148
|
+
|
|
149
|
+
If you are creating a new Skill:
|
|
150
|
+
|
|
151
|
+
1. Place the source materials, rules, or task examples in `sources/`.
|
|
152
|
+
2. Ask the AI agent to use the Skill authoring flow (`skill_flow_authoring`) to create a new Skill.
|
|
153
|
+
3. Have the authoring process separate procedure, source-backed knowledge, and runtime structure as needed.
|
|
154
|
+
4. Review whether the new Skill is usable for the intended work.
|
|
155
|
+
|
|
156
|
+
In both cases:
|
|
157
|
+
|
|
158
|
+
1. Give the AI agent a concrete work request with the goal, expected output, and constraints.
|
|
159
|
+
2. Inspect `work/` records as operational memory, then refine the Skill, knowledge, guard conditions, routing rules, and quality gates based on what happened.
|
|
160
|
+
|
|
161
|
+
## How to Explore This Repository
|
|
162
|
+
|
|
163
|
+
Point your AI agent at this repository and ask directly.
|
|
164
|
+
|
|
165
|
+
Startup instruction files for Claude, Codex, and GitHub Copilot are included.
|
|
166
|
+
|
|
167
|
+
These files are plain-text operating instructions. They do not contain API keys, provider credentials, hooks, MCP server definitions, or network redirection settings.
|
|
168
|
+
|
|
169
|
+
The agent can read the operating contract and explain the repository structure in context.
|
|
170
|
+
|
|
171
|
+
## Repository Map
|
|
172
|
+
|
|
173
|
+
- `xrefkit/`: installable runtime, resolver, Skill control, tools registry, and MCP adapter
|
|
174
|
+
- `docs/`: human-facing docs and policy
|
|
175
|
+
- `knowledge/`: source-backed knowledge fragments
|
|
176
|
+
- `sources/`: original materials for verification
|
|
177
|
+
- `skills/`: Skill definitions and routing index
|
|
178
|
+
- `tools/`: XID-backed client-side command implementations and packaged assets
|
|
179
|
+
- `work/`: operational memory for execution logs, judgments, handoffs, retrospectives, and improvement input
|
|
180
|
+
- `agent/`: agent entry and operating contract
|
|
181
|
+
- `human-docs/`: human-facing Japanese and English docs, materials, assets, and video packages
|
|
182
|
+
- `site/`: generated publication output, source manifest, and compatibility routes
|
|
183
|
+
|
|
184
|
+
## Runtime and Context Model
|
|
185
|
+
|
|
186
|
+
- Base runtime obligations are authored structurally and compiled into package resources with source hashes and token budgets.
|
|
187
|
+
- Repository, installed-package, and MCP providers resolve the same XID identities; conflicts and stale base packs fail explicitly.
|
|
188
|
+
|
|
189
|
+
The installed base runtime pack is generation-published. Formal consumers must
|
|
190
|
+
read `xrefkit/resources/base/current.json` first and then load both files from
|
|
191
|
+
the referenced `generations/<generation>/` directory. The top-level
|
|
192
|
+
`contracts.json` and `model_body.md` files are compatibility snapshots only;
|
|
193
|
+
they are not an authoritative source and must not be used for generation
|
|
194
|
+
consistency checks.
|
|
195
|
+
- Source structure is split into a target catalog and finding catalog. The AI loads lists before selected details.
|
|
196
|
+
- `xrefkit catalog maintain --apply-safe` promotes only unambiguous candidate findings; conflicts remain in a review queue.
|
|
197
|
+
- MCP exposes the shared resolver and catalogs. It does not own independent domain rules or execute client tools.
|
|
198
|
+
|
|
199
|
+
## Entry Points
|
|
200
|
+
|
|
201
|
+
- Human documentation: `docs/000_index.md`
|
|
202
|
+
- Human-facing language trees: `human-docs/ja/000_index.md`, `human-docs/en/`
|
|
203
|
+
- Agent entry: `agent/000_agent_entry.md`
|
xrefkit-0.3.0/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# XRefKit
|
|
2
|
+
|
|
3
|
+
AI agents often stop halfway, guess missing context, or produce work that looks
|
|
4
|
+
plausible but cannot be reviewed or handed off.
|
|
5
|
+
|
|
6
|
+
XRefKit is a portable Python package and repository model for AI-assisted work
|
|
7
|
+
that must reproduce domain procedures and judgments.
|
|
8
|
+
|
|
9
|
+
It runs as its own control repository and helps AI agents:
|
|
10
|
+
|
|
11
|
+
- load the right knowledge before acting
|
|
12
|
+
- select reusable Skills
|
|
13
|
+
- record judgments and evidence
|
|
14
|
+
- preserve handoffs across humans, agents, and sessions
|
|
15
|
+
- close work only through explicit quality gates
|
|
16
|
+
|
|
17
|
+
The package provides XID resolution, compact runtime contracts, Skill execution,
|
|
18
|
+
catalog-first context loading, deterministic closure gates, client-side tools,
|
|
19
|
+
and a thin MCP adapter over the same rules.
|
|
20
|
+
|
|
21
|
+
▶️ Download the 2-minute overview: [Why XRefKit exists and how it helps AI teams use domain knowledge](https://raw.githubusercontent.com/synthaicode/XRefKit/main/readme.mp4)
|
|
22
|
+
|
|
23
|
+
## Security and API Keys
|
|
24
|
+
|
|
25
|
+
XRefKit does not require Claude, OpenAI, GitHub, or other provider API keys to explore the repository.
|
|
26
|
+
|
|
27
|
+
This repository is a governance and knowledge-operations framework for AI-assisted work. It does not ask users to paste API keys into the repository, issue trackers, prompts, or configuration files.
|
|
28
|
+
|
|
29
|
+
If you use XRefKit with an external AI agent such as Claude Code, Codex, or GitHub Copilot, authenticate that agent through the official provider mechanism outside this repository.
|
|
30
|
+
|
|
31
|
+
Do not commit secrets, API keys, access tokens, `.env` files, or provider credentials to this repository.
|
|
32
|
+
|
|
33
|
+
XRefKit does not include repository-managed Claude settings, hooks, MCP server auto-approval, or provider endpoint redirection.
|
|
34
|
+
|
|
35
|
+
Before running any AI agent in this repository, review agent startup files and tool settings. XRefKit treats repository-controlled agent configuration as part of the trust boundary.
|
|
36
|
+
|
|
37
|
+
## The Problem
|
|
38
|
+
|
|
39
|
+
Using AI for real work creates recurring operating problems:
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
- the AI can act from incomplete context or unsupported guesses
|
|
44
|
+
- procedures, domain facts, and judgment criteria get mixed together in prompts
|
|
45
|
+
- execution, checking, and handoff collapse into one opaque step
|
|
46
|
+
- work becomes hard to continue across agents, humans, or sessions
|
|
47
|
+
- outputs may lack evidence, closure discipline, or auditability
|
|
48
|
+
|
|
49
|
+
## What XRefKit Provides
|
|
50
|
+
|
|
51
|
+
XRefKit makes AI work explicit by separating:
|
|
52
|
+
|
|
53
|
+
- Skills: executable work units, each identified by a capability/tuning/responsibility triad and carrying its execution and check contract
|
|
54
|
+
- Knowledge: source-backed domain facts and local rules loaded only when needed
|
|
55
|
+
- Workflow protocol: the generic, deterministic per-Skill control (phases, verification, closure) that wraps every Skill run
|
|
56
|
+
- Semantic routing: selecting the right Skill for a goal from user intent and the Skill catalog
|
|
57
|
+
- Evidence: logs, judgments, concerns, and quality checks
|
|
58
|
+
- XIDs: stable references that survive file movement and restructuring so AI can load targeted context without treating the whole repository as one prompt
|
|
59
|
+
|
|
60
|
+
This separation prevents prompts, domain facts, execution steps, review criteria,
|
|
61
|
+
and handoff records from collapsing into one opaque instruction block.
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
## How It Works
|
|
66
|
+
|
|
67
|
+
1. Original materials are kept in `sources/`.
|
|
68
|
+
2. AI-readable knowledge is maintained in `knowledge/`.
|
|
69
|
+
3. Work is defined in `skills/` (executable procedure with a capability/tuning/responsibility identity) and `knowledge/`.
|
|
70
|
+
4. Agents are routed semantically to the right Skill and load only the relevant context.
|
|
71
|
+
5. Evidence and quality gates make incomplete or unsupported work visible.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
Install the package and initialize an instance:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
python -m pip install -e .
|
|
79
|
+
xrefkit init
|
|
80
|
+
xrefkit --help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Start the integrated MCP server over stdio:
|
|
84
|
+
|
|
85
|
+
```powershell
|
|
86
|
+
xrefkit mcp serve --repo . --transport stdio
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The server writes structured correlation events to
|
|
90
|
+
`work/mcp/xid_audit.jsonl` by default. After `xrefkit skill run` returns a
|
|
91
|
+
`run_id`, the client calls MCP `bind_skill_run` and executes the returned
|
|
92
|
+
`client_record_command` against the local `run_log`. Subsequent MCP Knowledge
|
|
93
|
+
searches and XID resolutions then share the same `run_id` as the client Skill
|
|
94
|
+
Run. The client separately records actual model-context loading and judgment
|
|
95
|
+
application with `xrefkit skill knowledge --action load|apply`.
|
|
96
|
+
|
|
97
|
+
XRefKit is designed to be driven by an AI agent. The agent first resolves the
|
|
98
|
+
startup contract XID, selects a Skill or source target from a compact catalog,
|
|
99
|
+
and expands only the selected body.
|
|
100
|
+
|
|
101
|
+
Here, `sources/` is the human drop point for original materials, existing Skill artifacts, rules, and examples that the AI will turn into repository-managed assets.
|
|
102
|
+
|
|
103
|
+
If you are migrating an existing Skill:
|
|
104
|
+
|
|
105
|
+
1. Place the source Skill or related source materials in `sources/`.
|
|
106
|
+
2. Ask the AI agent to migrate that Skill into the XRefKit repository model.
|
|
107
|
+
3. Have the migration process separate procedure, source-backed knowledge, and runtime structure as needed.
|
|
108
|
+
4. Review whether the migrated Skill is usable for the intended work.
|
|
109
|
+
|
|
110
|
+
If you are creating a new Skill:
|
|
111
|
+
|
|
112
|
+
1. Place the source materials, rules, or task examples in `sources/`.
|
|
113
|
+
2. Ask the AI agent to use the Skill authoring flow (`skill_flow_authoring`) to create a new Skill.
|
|
114
|
+
3. Have the authoring process separate procedure, source-backed knowledge, and runtime structure as needed.
|
|
115
|
+
4. Review whether the new Skill is usable for the intended work.
|
|
116
|
+
|
|
117
|
+
In both cases:
|
|
118
|
+
|
|
119
|
+
1. Give the AI agent a concrete work request with the goal, expected output, and constraints.
|
|
120
|
+
2. Inspect `work/` records as operational memory, then refine the Skill, knowledge, guard conditions, routing rules, and quality gates based on what happened.
|
|
121
|
+
|
|
122
|
+
## How to Explore This Repository
|
|
123
|
+
|
|
124
|
+
Point your AI agent at this repository and ask directly.
|
|
125
|
+
|
|
126
|
+
Startup instruction files for Claude, Codex, and GitHub Copilot are included.
|
|
127
|
+
|
|
128
|
+
These files are plain-text operating instructions. They do not contain API keys, provider credentials, hooks, MCP server definitions, or network redirection settings.
|
|
129
|
+
|
|
130
|
+
The agent can read the operating contract and explain the repository structure in context.
|
|
131
|
+
|
|
132
|
+
## Repository Map
|
|
133
|
+
|
|
134
|
+
- `xrefkit/`: installable runtime, resolver, Skill control, tools registry, and MCP adapter
|
|
135
|
+
- `docs/`: human-facing docs and policy
|
|
136
|
+
- `knowledge/`: source-backed knowledge fragments
|
|
137
|
+
- `sources/`: original materials for verification
|
|
138
|
+
- `skills/`: Skill definitions and routing index
|
|
139
|
+
- `tools/`: XID-backed client-side command implementations and packaged assets
|
|
140
|
+
- `work/`: operational memory for execution logs, judgments, handoffs, retrospectives, and improvement input
|
|
141
|
+
- `agent/`: agent entry and operating contract
|
|
142
|
+
- `human-docs/`: human-facing Japanese and English docs, materials, assets, and video packages
|
|
143
|
+
- `site/`: generated publication output, source manifest, and compatibility routes
|
|
144
|
+
|
|
145
|
+
## Runtime and Context Model
|
|
146
|
+
|
|
147
|
+
- Base runtime obligations are authored structurally and compiled into package resources with source hashes and token budgets.
|
|
148
|
+
- Repository, installed-package, and MCP providers resolve the same XID identities; conflicts and stale base packs fail explicitly.
|
|
149
|
+
|
|
150
|
+
The installed base runtime pack is generation-published. Formal consumers must
|
|
151
|
+
read `xrefkit/resources/base/current.json` first and then load both files from
|
|
152
|
+
the referenced `generations/<generation>/` directory. The top-level
|
|
153
|
+
`contracts.json` and `model_body.md` files are compatibility snapshots only;
|
|
154
|
+
they are not an authoritative source and must not be used for generation
|
|
155
|
+
consistency checks.
|
|
156
|
+
- Source structure is split into a target catalog and finding catalog. The AI loads lists before selected details.
|
|
157
|
+
- `xrefkit catalog maintain --apply-safe` promotes only unambiguous candidate findings; conflicts remain in a review queue.
|
|
158
|
+
- MCP exposes the shared resolver and catalogs. It does not own independent domain rules or execute client tools.
|
|
159
|
+
|
|
160
|
+
## Entry Points
|
|
161
|
+
|
|
162
|
+
- Human documentation: `docs/000_index.md`
|
|
163
|
+
- Human-facing language trees: `human-docs/ja/000_index.md`, `human-docs/en/`
|
|
164
|
+
- Agent entry: `agent/000_agent_entry.md`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xrefkit"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Portable XID, Skill, Knowledge, workflow, and MCP runtime for XRefKit"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [{ name = "synthaicode" }]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"PyYAML>=6.0.2,<7",
|
|
15
|
+
"pydantic>=2.0,<3",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.optional-dependencies]
|
|
19
|
+
mcp = ["mcp>=1.0.0", "uvicorn>=0.30"]
|
|
20
|
+
test = ["pytest>=8.0.0"]
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
xrefkit = "xrefkit.cli:main"
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.packages.find]
|
|
26
|
+
where = ["."]
|
|
27
|
+
include = ["xrefkit*"]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.package-data]
|
|
30
|
+
xrefkit = ["resources/**/*"]
|
|
31
|
+
|
|
32
|
+
[tool.pytest.ini_options]
|
|
33
|
+
testpaths = ["tests"]
|
|
34
|
+
pythonpath = ["."]
|
xrefkit-0.3.0/setup.cfg
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from xrefkit.ownership import load_ownership
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _load_sync_module():
|
|
10
|
+
module_path = Path(__file__).resolve().parents[1] / "handoff" / "base_sync" / "xrefkit_sync_worklist.py"
|
|
11
|
+
spec = importlib.util.spec_from_file_location("xrefkit_sync_worklist", module_path)
|
|
12
|
+
assert spec and spec.loader
|
|
13
|
+
module = importlib.util.module_from_spec(spec)
|
|
14
|
+
spec.loader.exec_module(module)
|
|
15
|
+
return module
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BaseSyncOwnershipTests(unittest.TestCase):
|
|
19
|
+
def test_pack_move_classifies_as_moved_in_base(self) -> None:
|
|
20
|
+
sync = _load_sync_module()
|
|
21
|
+
local = sync.State()
|
|
22
|
+
copy = sync.State()
|
|
23
|
+
head = sync.State()
|
|
24
|
+
digest = "same-content"
|
|
25
|
+
local.docs["DOC123456789"] = {
|
|
26
|
+
"path": "docs/packs/business-intake/entry.md",
|
|
27
|
+
"hash": digest,
|
|
28
|
+
"anchors": ["DOC123456789"],
|
|
29
|
+
}
|
|
30
|
+
copy.docs["DOC123456789"] = {
|
|
31
|
+
"path": "docs/packs/business-intake/entry.md",
|
|
32
|
+
"hash": digest,
|
|
33
|
+
"anchors": ["DOC123456789"],
|
|
34
|
+
}
|
|
35
|
+
head.docs["DOC123456789"] = {
|
|
36
|
+
"path": "packs/business-intake/pack.md",
|
|
37
|
+
"hash": digest,
|
|
38
|
+
"anchors": ["DOC123456789"],
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
items = sync.classify_docs(local, copy, head)
|
|
42
|
+
|
|
43
|
+
self.assertEqual("moved_in_base", items[0]["kind"])
|
|
44
|
+
self.assertEqual("packs/business-intake/pack.md", items[0]["head_path"])
|
|
45
|
+
|
|
46
|
+
def test_scan_local_excludes_local_pack_zone(self) -> None:
|
|
47
|
+
sync = _load_sync_module()
|
|
48
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
49
|
+
root = Path(tmp)
|
|
50
|
+
(root / "ownership.yaml").write_text(
|
|
51
|
+
"zones:\n"
|
|
52
|
+
" - id: local-packs\n"
|
|
53
|
+
" owner: local\n"
|
|
54
|
+
" paths:\n"
|
|
55
|
+
" - packs/local/\n"
|
|
56
|
+
" catalog: true\n"
|
|
57
|
+
" distribution: false\n"
|
|
58
|
+
" base_sync: false\n"
|
|
59
|
+
" shadowing: true\n"
|
|
60
|
+
" - id: shared-packs\n"
|
|
61
|
+
" owner: pack\n"
|
|
62
|
+
" paths:\n"
|
|
63
|
+
" - packs/*/\n"
|
|
64
|
+
" catalog: true\n"
|
|
65
|
+
" distribution: true\n"
|
|
66
|
+
" base_sync: true\n"
|
|
67
|
+
" shadowing: true\n",
|
|
68
|
+
encoding="utf-8",
|
|
69
|
+
)
|
|
70
|
+
local_doc = root / "packs" / "local" / "acme" / "knowledge" / "fact.md"
|
|
71
|
+
local_doc.parent.mkdir(parents=True)
|
|
72
|
+
local_doc.write_text(
|
|
73
|
+
"<!-- xid: LOCAL123456 -->\n<a id=\"xid-LOCAL123456\"></a>\n\n# Local\n",
|
|
74
|
+
encoding="utf-8",
|
|
75
|
+
)
|
|
76
|
+
shared_doc = root / "packs" / "shared" / "knowledge" / "fact.md"
|
|
77
|
+
shared_doc.parent.mkdir(parents=True)
|
|
78
|
+
shared_doc.write_text(
|
|
79
|
+
"<!-- xid: SHARED123456 -->\n<a id=\"xid-SHARED123456\"></a>\n\n# Shared\n",
|
|
80
|
+
encoding="utf-8",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
ownership = load_ownership(root)
|
|
84
|
+
state, problems = sync.scan_local(root, ownership)
|
|
85
|
+
|
|
86
|
+
self.assertEqual([], problems)
|
|
87
|
+
self.assertNotIn("LOCAL123456", state.docs)
|
|
88
|
+
self.assertIn("SHARED123456", state.docs)
|
|
89
|
+
|
|
90
|
+
def test_state_from_files_excludes_non_base_sync_zone(self) -> None:
|
|
91
|
+
sync = _load_sync_module()
|
|
92
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
93
|
+
root = Path(tmp)
|
|
94
|
+
(root / "ownership.yaml").write_text(
|
|
95
|
+
"zones:\n"
|
|
96
|
+
" - id: derived\n"
|
|
97
|
+
" owner: generated\n"
|
|
98
|
+
" paths:\n"
|
|
99
|
+
" - site/\n"
|
|
100
|
+
" catalog: false\n"
|
|
101
|
+
" distribution: false\n"
|
|
102
|
+
" base_sync: false\n"
|
|
103
|
+
" shadowing: false\n",
|
|
104
|
+
encoding="utf-8",
|
|
105
|
+
)
|
|
106
|
+
ownership = load_ownership(root)
|
|
107
|
+
blobs = {
|
|
108
|
+
"a": {"kind": "plain", "hash": "plain-a"},
|
|
109
|
+
"b": {"kind": "plain", "hash": "plain-b"},
|
|
110
|
+
}
|
|
111
|
+
files = {
|
|
112
|
+
"site/index.json": "a",
|
|
113
|
+
"handoff/base_sync/HANDOFF.md": "b",
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
state = sync.state_from_files(files, blobs, ownership)
|
|
117
|
+
|
|
118
|
+
self.assertNotIn("site/index.json", state.plain)
|
|
119
|
+
self.assertEqual("plain-b", state.plain["handoff/base_sync/HANDOFF.md"])
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
unittest.main()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from xrefkit.skillmeta import validate_skill_meta
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_generic_calibration_wording_is_candidate_only_warning(tmp_path: Path) -> None:
|
|
9
|
+
skill = tmp_path / "skills/sample"
|
|
10
|
+
skill.mkdir(parents=True)
|
|
11
|
+
(skill / "meta.md").write_text(
|
|
12
|
+
"""# Skill Meta: sample
|
|
13
|
+
|
|
14
|
+
- skill_id: `sample`
|
|
15
|
+
- summary: sample
|
|
16
|
+
- use_when: sample task
|
|
17
|
+
- input: input
|
|
18
|
+
- output: output
|
|
19
|
+
- skill_doc: `SKILL.md`
|
|
20
|
+
- maturity: `draft`
|
|
21
|
+
""",
|
|
22
|
+
encoding="utf-8",
|
|
23
|
+
)
|
|
24
|
+
(skill / "SKILL.md").write_text(
|
|
25
|
+
"# Sample\n\n- Downgrade unsupported conclusions to unknown.\n",
|
|
26
|
+
encoding="utf-8",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
result = validate_skill_meta(skill / "meta.md", check_level="draft")
|
|
30
|
+
|
|
31
|
+
assert result.ok is True
|
|
32
|
+
assert any("generic calibration wording candidate" in item for item in result.warnings)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_skill_template_does_not_embed_generic_calibration_placeholder() -> None:
|
|
36
|
+
root = Path(__file__).resolve().parents[1]
|
|
37
|
+
template = (
|
|
38
|
+
root / "skills/os/skill_flow_authoring/references/skill_body_template.md"
|
|
39
|
+
).read_text(encoding="utf-8")
|
|
40
|
+
|
|
41
|
+
assert "downgrade unsupported inference" not in template
|