xrefkit 0.3.0__py3-none-any.whl
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/__init__.py +5 -0
- xrefkit/__main__.py +5 -0
- xrefkit/catalog_cli.py +57 -0
- xrefkit/cli.py +71 -0
- xrefkit/contracts.py +297 -0
- xrefkit/ctx.py +160 -0
- xrefkit/dashboard.py +1220 -0
- xrefkit/discovery.py +85 -0
- xrefkit/gate.py +428 -0
- xrefkit/goalstate.py +555 -0
- xrefkit/hashing.py +18 -0
- xrefkit/import_skill.py +469 -0
- xrefkit/instance.py +133 -0
- xrefkit/loaders.py +77 -0
- xrefkit/mcp/__init__.py +26 -0
- xrefkit/mcp/audit.py +168 -0
- xrefkit/mcp/bootstrap.py +337 -0
- xrefkit/mcp/catalog.py +2638 -0
- xrefkit/mcp/cli.py +173 -0
- xrefkit/mcp/client_cache.py +356 -0
- xrefkit/mcp/context_registry.py +277 -0
- xrefkit/mcp/contracts.py +243 -0
- xrefkit/mcp/dist.py +234 -0
- xrefkit/mcp/ownership.py +246 -0
- xrefkit/mcp/repository.py +217 -0
- xrefkit/mcp/schemas.py +349 -0
- xrefkit/mcp/server.py +773 -0
- xrefkit/mcp/startup_contract_pack.py +154 -0
- xrefkit/mcp_tools.py +47 -0
- xrefkit/models/__init__.py +41 -0
- xrefkit/models/common.py +185 -0
- xrefkit/models/effective_bundle.py +131 -0
- xrefkit/models/local_manifest.py +217 -0
- xrefkit/models/package_manifest.py +126 -0
- xrefkit/models/run_log.py +276 -0
- xrefkit/models/server_config.py +160 -0
- xrefkit/models/skill_definition.py +131 -0
- xrefkit/operations_cli.py +670 -0
- xrefkit/ownership.py +276 -0
- xrefkit/packmeta.py +289 -0
- xrefkit/registry.py +334 -0
- xrefkit/resolver.py +252 -0
- xrefkit/resource_provider.py +187 -0
- xrefkit/resources/base/contracts.json +178 -0
- xrefkit/resources/base/current.json +6 -0
- xrefkit/resources/base/generations/7a682a5272907354/contracts.json +178 -0
- xrefkit/resources/base/generations/7a682a5272907354/model_body.md +22 -0
- xrefkit/resources/base/generations/9929294385ccb7b0/contracts.json +178 -0
- xrefkit/resources/base/generations/9929294385ccb7b0/model_body.md +22 -0
- xrefkit/resources/base/model_body.md +22 -0
- xrefkit/runlog.py +45 -0
- xrefkit/skillmeta.py +1034 -0
- xrefkit/skillrun.py +2381 -0
- xrefkit/structure_catalog.py +199 -0
- xrefkit/tools/__init__.py +119 -0
- xrefkit/tools/__main__.py +4 -0
- xrefkit/v2_cli.py +130 -0
- xrefkit/workspace.py +117 -0
- xrefkit/xref.py +1048 -0
- xrefkit-0.3.0.dist-info/METADATA +203 -0
- xrefkit-0.3.0.dist-info/RECORD +65 -0
- xrefkit-0.3.0.dist-info/WHEEL +5 -0
- xrefkit-0.3.0.dist-info/entry_points.txt +2 -0
- xrefkit-0.3.0.dist-info/licenses/LICENSE +21 -0
- xrefkit-0.3.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "xrefkit.compiled_runtime/v1",
|
|
3
|
+
"profile": "model-compact",
|
|
4
|
+
"compiler_version": 1,
|
|
5
|
+
"manifest_path": "docs\\core\\contracts\\base_runtime_manifest.yaml",
|
|
6
|
+
"manifest_hash": "9edce0a8e59b57651c97c2b90ee7ed5769bc462f15874d6ad67cc3b27dda0759",
|
|
7
|
+
"approval": {
|
|
8
|
+
"status": "accepted",
|
|
9
|
+
"owner": "repository_owner",
|
|
10
|
+
"approved_on": "2026-07-10",
|
|
11
|
+
"reference": "user-directed execution of design 087"
|
|
12
|
+
},
|
|
13
|
+
"estimator": {
|
|
14
|
+
"id": "chars_div_4",
|
|
15
|
+
"version": 1
|
|
16
|
+
},
|
|
17
|
+
"budgets": {
|
|
18
|
+
"l0_tokens": 2500,
|
|
19
|
+
"l1_tokens": 6000,
|
|
20
|
+
"selected_context_tokens": 12000
|
|
21
|
+
},
|
|
22
|
+
"sources": [
|
|
23
|
+
{
|
|
24
|
+
"xid": "0B5C58B5E5B2",
|
|
25
|
+
"path": "agent/000_agent_entry.md",
|
|
26
|
+
"source_hash": "fa232a532d9f9b0be97fb91b16492ece7c7358effd4b09b596dcfec24b7da956"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"xid": "5A1C8E4D2F90",
|
|
30
|
+
"path": "docs/core/models/017_base_and_xref_layering.md",
|
|
31
|
+
"source_hash": "147c05288aae0212ba90e37adfd9f3c47d899c05f0a01222ce06949090f01d89"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"xid": "6C0B62D6366A",
|
|
35
|
+
"path": "docs/core/contracts/011_startup_xref_routing.md",
|
|
36
|
+
"source_hash": "ed8a211759051121ee2f049207fc079e5b50247f9995cc7bbb38a748e2964d09"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"xid": "8A666C1FD121",
|
|
40
|
+
"path": "docs/core/contracts/016_uncertainty_protocol.md",
|
|
41
|
+
"source_hash": "6fa3513c71bff7660394cc5cfc1b6c90de1d50d30f43eb0e6341699559fddc6a"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"xid": "A7F3C92D4E11",
|
|
45
|
+
"path": "docs/core/contracts/053_context_direction_security_guard.md",
|
|
46
|
+
"source_hash": "7f1ad91351820bcf60569245fcff86c36be1e41b6e1345057051cf524d911a70"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"xid": "4A423E72D2ED",
|
|
50
|
+
"path": "docs/core/contracts/015_shared_memory_operations.md",
|
|
51
|
+
"source_hash": "7972b9d813c57a3ea4901949236d600591ac766544ae426771e391f64312881f"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"xid": "B7A2C94F0E61",
|
|
55
|
+
"path": "docs/core/contracts/058_skill_operating_contract.md",
|
|
56
|
+
"source_hash": "499a57cb279c74df782148e51f82401345cccf62949a05a9ec2c648d45edad04"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"xid": "C3A1F78D9B22",
|
|
60
|
+
"path": "docs/core/contracts/080_xrefkit_startup_contract.md",
|
|
61
|
+
"source_hash": "06888669707057e3aba2498a962a9e522d683613972b2d598dc29ea70d5eda8a"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"obligations": [
|
|
65
|
+
{
|
|
66
|
+
"id": "skill.os_contract_required",
|
|
67
|
+
"source_xid": "0B5C58B5E5B2",
|
|
68
|
+
"level": "must",
|
|
69
|
+
"statement": "New Skills include the Skill operating contract."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "skill.run_first",
|
|
73
|
+
"source_xid": "0B5C58B5E5B2",
|
|
74
|
+
"level": "must",
|
|
75
|
+
"statement": "Start Skill execution through the runtime envelope before loading the Skill body."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "skill.workitem_required",
|
|
79
|
+
"source_xid": "0B5C58B5E5B2",
|
|
80
|
+
"level": "must",
|
|
81
|
+
"statement": "Record concrete work items before closure."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "skill.artifact_required",
|
|
85
|
+
"source_xid": "0B5C58B5E5B2",
|
|
86
|
+
"level": "must",
|
|
87
|
+
"statement": "Record output and evidence artifacts before closure."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "skill.concern_required",
|
|
91
|
+
"source_xid": "0B5C58B5E5B2",
|
|
92
|
+
"level": "must",
|
|
93
|
+
"statement": "Record closure-relevant unknowns, risks, and judgments."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "skill.verify_separate",
|
|
97
|
+
"source_xid": "0B5C58B5E5B2",
|
|
98
|
+
"level": "must",
|
|
99
|
+
"statement": "Advance check through deterministic verification, not the producer context."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "work.log_required",
|
|
103
|
+
"source_xid": "0B5C58B5E5B2",
|
|
104
|
+
"level": "must",
|
|
105
|
+
"statement": "Write execution logs and retrospectives under work."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "work.date_prefix",
|
|
109
|
+
"source_xid": "0B5C58B5E5B2",
|
|
110
|
+
"level": "must",
|
|
111
|
+
"statement": "Use date-prefixed work-record filenames."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"id": "work.session_before_complete",
|
|
115
|
+
"source_xid": "0B5C58B5E5B2",
|
|
116
|
+
"level": "must",
|
|
117
|
+
"statement": "Update a session log before completion, commit, or push."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": "work.promote_stable",
|
|
121
|
+
"source_xid": "0B5C58B5E5B2",
|
|
122
|
+
"level": "must",
|
|
123
|
+
"statement": "Promote stabilized facts and decisions to canonical locations."
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": "uncertainty.explicit",
|
|
127
|
+
"source_xid": "8A666C1FD121",
|
|
128
|
+
"level": "must",
|
|
129
|
+
"statement": "Classify and expose material uncertainty, search Knowledge, and pause risky work."
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "claims.no_unsupported_fact",
|
|
133
|
+
"source_xid": "8A666C1FD121",
|
|
134
|
+
"level": "must",
|
|
135
|
+
"statement": "Do not present unsupported claims as facts; expose the evidence gap and route material uncertainty through the uncertainty protocol."
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "memory.write",
|
|
139
|
+
"source_xid": "4A423E72D2ED",
|
|
140
|
+
"level": "must",
|
|
141
|
+
"statement": "Write logs after significant discussions, decisions, or work sessions."
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": "memory.session",
|
|
145
|
+
"source_xid": "4A423E72D2ED",
|
|
146
|
+
"level": "must",
|
|
147
|
+
"statement": "Ensure a work session entry exists before final response."
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": "memory.before_publish",
|
|
151
|
+
"source_xid": "4A423E72D2ED",
|
|
152
|
+
"level": "must",
|
|
153
|
+
"statement": "Update logs before commit or push."
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "memory.promote",
|
|
157
|
+
"source_xid": "4A423E72D2ED",
|
|
158
|
+
"level": "must",
|
|
159
|
+
"statement": "Promote stabilized work content into canonical docs or Knowledge."
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "memory.filename",
|
|
163
|
+
"source_xid": "4A423E72D2ED",
|
|
164
|
+
"level": "must",
|
|
165
|
+
"statement": "Prefix work record filenames with the date."
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"conditional_loads": [
|
|
169
|
+
{
|
|
170
|
+
"xid": "B7A2C94F0E61",
|
|
171
|
+
"when": "skill_execution"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"lint_candidates": [],
|
|
175
|
+
"model_body_hash": "5251a22001428241b90e7edc34867462de36f3eb048720a7e6f175f4679b3def",
|
|
176
|
+
"estimated_tokens": 418,
|
|
177
|
+
"release_ready": true
|
|
178
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# XRefKit Base Runtime Contract
|
|
2
|
+
|
|
3
|
+
- [must] skill.os_contract_required: New Skills include the Skill operating contract.
|
|
4
|
+
- [must] skill.run_first: Start Skill execution through the runtime envelope before loading the Skill body.
|
|
5
|
+
- [must] skill.workitem_required: Record concrete work items before closure.
|
|
6
|
+
- [must] skill.artifact_required: Record output and evidence artifacts before closure.
|
|
7
|
+
- [must] skill.concern_required: Record closure-relevant unknowns, risks, and judgments.
|
|
8
|
+
- [must] skill.verify_separate: Advance check through deterministic verification, not the producer context.
|
|
9
|
+
- [must] work.log_required: Write execution logs and retrospectives under work.
|
|
10
|
+
- [must] work.date_prefix: Use date-prefixed work-record filenames.
|
|
11
|
+
- [must] work.session_before_complete: Update a session log before completion, commit, or push.
|
|
12
|
+
- [must] work.promote_stable: Promote stabilized facts and decisions to canonical locations.
|
|
13
|
+
- [must] uncertainty.explicit: Classify and expose material uncertainty, search Knowledge, and pause risky work.
|
|
14
|
+
- [must] claims.no_unsupported_fact: Do not present unsupported claims as facts; expose the evidence gap and route material uncertainty through the uncertainty protocol.
|
|
15
|
+
- [must] memory.write: Write logs after significant discussions, decisions, or work sessions.
|
|
16
|
+
- [must] memory.session: Ensure a work session entry exists before final response.
|
|
17
|
+
- [must] memory.before_publish: Update logs before commit or push.
|
|
18
|
+
- [must] memory.promote: Promote stabilized work content into canonical docs or Knowledge.
|
|
19
|
+
- [must] memory.filename: Prefix work record filenames with the date.
|
|
20
|
+
|
|
21
|
+
Conditional loads:
|
|
22
|
+
- skill_execution: xid B7A2C94F0E61
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# XRefKit Base Runtime Contract
|
|
2
|
+
|
|
3
|
+
- [must] skill.os_contract_required: New Skills include the Skill operating contract.
|
|
4
|
+
- [must] skill.run_first: Start Skill execution through the runtime envelope before loading the Skill body.
|
|
5
|
+
- [must] skill.workitem_required: Record concrete work items before closure.
|
|
6
|
+
- [must] skill.artifact_required: Record output and evidence artifacts before closure.
|
|
7
|
+
- [must] skill.concern_required: Record closure-relevant unknowns, risks, and judgments.
|
|
8
|
+
- [must] skill.verify_separate: Advance check through deterministic verification, not the producer context.
|
|
9
|
+
- [must] work.log_required: Write execution logs and retrospectives under work.
|
|
10
|
+
- [must] work.date_prefix: Use date-prefixed work-record filenames.
|
|
11
|
+
- [must] work.session_before_complete: Update a session log before completion, commit, or push.
|
|
12
|
+
- [must] work.promote_stable: Promote stabilized facts and decisions to canonical locations.
|
|
13
|
+
- [must] uncertainty.explicit: Classify and expose material uncertainty, search Knowledge, and pause risky work.
|
|
14
|
+
- [must] claims.no_unsupported_fact: Do not present unsupported claims as facts; expose the evidence gap and route material uncertainty through the uncertainty protocol.
|
|
15
|
+
- [must] memory.write: Write logs after significant discussions, decisions, or work sessions.
|
|
16
|
+
- [must] memory.session: Ensure a work session entry exists before final response.
|
|
17
|
+
- [must] memory.before_publish: Update logs before commit or push.
|
|
18
|
+
- [must] memory.promote: Promote stabilized work content into canonical docs or Knowledge.
|
|
19
|
+
- [must] memory.filename: Prefix work record filenames with the date.
|
|
20
|
+
|
|
21
|
+
Conditional loads:
|
|
22
|
+
- skill_execution: xid B7A2C94F0E61
|
xrefkit/runlog.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""JSONL run log writer and reader."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from pydantic import TypeAdapter
|
|
9
|
+
|
|
10
|
+
from .models import RunLogAggregate, RunLogEvent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
_EVENT_ADAPTER = TypeAdapter(RunLogEvent)
|
|
14
|
+
_EVENT_LIST_ADAPTER = TypeAdapter(list[RunLogEvent])
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class JsonlRunLogWriter:
|
|
18
|
+
def __init__(self, path: str | Path) -> None:
|
|
19
|
+
self.path = Path(path)
|
|
20
|
+
|
|
21
|
+
def append(self, event: RunLogEvent) -> None:
|
|
22
|
+
self.path.parent.mkdir(parents=True, exist_ok=True)
|
|
23
|
+
with self.path.open("a", encoding="utf-8") as handle:
|
|
24
|
+
handle.write(json.dumps(event.model_dump(mode="json"), ensure_ascii=False, separators=(",", ":")))
|
|
25
|
+
handle.write("\n")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def read_run_log_events(path: str | Path) -> list[RunLogEvent]:
|
|
29
|
+
events: list[RunLogEvent] = []
|
|
30
|
+
with Path(path).open("r", encoding="utf-8") as handle:
|
|
31
|
+
for line_no, line in enumerate(handle, start=1):
|
|
32
|
+
stripped = line.strip()
|
|
33
|
+
if not stripped:
|
|
34
|
+
continue
|
|
35
|
+
try:
|
|
36
|
+
raw = json.loads(stripped)
|
|
37
|
+
except json.JSONDecodeError as exc:
|
|
38
|
+
raise ValueError(f"invalid JSONL at line {line_no}: {exc}") from exc
|
|
39
|
+
events.append(_EVENT_ADAPTER.validate_python(raw))
|
|
40
|
+
return events
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def read_run_log_aggregate(path: str | Path, run_id: str) -> RunLogAggregate:
|
|
44
|
+
events = [event for event in read_run_log_events(path) if event.run_id == run_id]
|
|
45
|
+
return RunLogAggregate(run_id=run_id, events=_EVENT_LIST_ADAPTER.validate_python(events))
|