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.
Files changed (65) hide show
  1. xrefkit/__init__.py +5 -0
  2. xrefkit/__main__.py +5 -0
  3. xrefkit/catalog_cli.py +57 -0
  4. xrefkit/cli.py +71 -0
  5. xrefkit/contracts.py +297 -0
  6. xrefkit/ctx.py +160 -0
  7. xrefkit/dashboard.py +1220 -0
  8. xrefkit/discovery.py +85 -0
  9. xrefkit/gate.py +428 -0
  10. xrefkit/goalstate.py +555 -0
  11. xrefkit/hashing.py +18 -0
  12. xrefkit/import_skill.py +469 -0
  13. xrefkit/instance.py +133 -0
  14. xrefkit/loaders.py +77 -0
  15. xrefkit/mcp/__init__.py +26 -0
  16. xrefkit/mcp/audit.py +168 -0
  17. xrefkit/mcp/bootstrap.py +337 -0
  18. xrefkit/mcp/catalog.py +2638 -0
  19. xrefkit/mcp/cli.py +173 -0
  20. xrefkit/mcp/client_cache.py +356 -0
  21. xrefkit/mcp/context_registry.py +277 -0
  22. xrefkit/mcp/contracts.py +243 -0
  23. xrefkit/mcp/dist.py +234 -0
  24. xrefkit/mcp/ownership.py +246 -0
  25. xrefkit/mcp/repository.py +217 -0
  26. xrefkit/mcp/schemas.py +349 -0
  27. xrefkit/mcp/server.py +773 -0
  28. xrefkit/mcp/startup_contract_pack.py +154 -0
  29. xrefkit/mcp_tools.py +47 -0
  30. xrefkit/models/__init__.py +41 -0
  31. xrefkit/models/common.py +185 -0
  32. xrefkit/models/effective_bundle.py +131 -0
  33. xrefkit/models/local_manifest.py +217 -0
  34. xrefkit/models/package_manifest.py +126 -0
  35. xrefkit/models/run_log.py +276 -0
  36. xrefkit/models/server_config.py +160 -0
  37. xrefkit/models/skill_definition.py +131 -0
  38. xrefkit/operations_cli.py +670 -0
  39. xrefkit/ownership.py +276 -0
  40. xrefkit/packmeta.py +289 -0
  41. xrefkit/registry.py +334 -0
  42. xrefkit/resolver.py +252 -0
  43. xrefkit/resource_provider.py +187 -0
  44. xrefkit/resources/base/contracts.json +178 -0
  45. xrefkit/resources/base/current.json +6 -0
  46. xrefkit/resources/base/generations/7a682a5272907354/contracts.json +178 -0
  47. xrefkit/resources/base/generations/7a682a5272907354/model_body.md +22 -0
  48. xrefkit/resources/base/generations/9929294385ccb7b0/contracts.json +178 -0
  49. xrefkit/resources/base/generations/9929294385ccb7b0/model_body.md +22 -0
  50. xrefkit/resources/base/model_body.md +22 -0
  51. xrefkit/runlog.py +45 -0
  52. xrefkit/skillmeta.py +1034 -0
  53. xrefkit/skillrun.py +2381 -0
  54. xrefkit/structure_catalog.py +199 -0
  55. xrefkit/tools/__init__.py +119 -0
  56. xrefkit/tools/__main__.py +4 -0
  57. xrefkit/v2_cli.py +130 -0
  58. xrefkit/workspace.py +117 -0
  59. xrefkit/xref.py +1048 -0
  60. xrefkit-0.3.0.dist-info/METADATA +203 -0
  61. xrefkit-0.3.0.dist-info/RECORD +65 -0
  62. xrefkit-0.3.0.dist-info/WHEEL +5 -0
  63. xrefkit-0.3.0.dist-info/entry_points.txt +2 -0
  64. xrefkit-0.3.0.dist-info/licenses/LICENSE +21 -0
  65. xrefkit-0.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,187 @@
1
+ """Mode-aware resource providers for XID resolution."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import json
7
+ import re
8
+ from dataclasses import dataclass
9
+ from pathlib import Path
10
+ from typing import Literal, Protocol
11
+ from importlib import resources
12
+
13
+
14
+ ProviderKind = Literal["repository", "instance", "content_pack", "package", "mcp"]
15
+ ResolverMode = Literal["repository", "installed", "mcp_only", "mcp_server"]
16
+ XID_RE = re.compile(r"<!--\s*xid:\s*([A-Fa-f0-9]{12})\s*-->")
17
+
18
+
19
+ def _hash_bytes(content: bytes) -> str:
20
+ return hashlib.sha256(content).hexdigest()
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class Resource:
25
+ xid: str
26
+ body: str
27
+ content_hash: str
28
+ provider: str
29
+ provider_kind: ProviderKind
30
+ path: str | None = None
31
+
32
+
33
+ class ResourceProvider(Protocol):
34
+ name: str
35
+ kind: ProviderKind
36
+
37
+ def get(self, xid: str) -> Resource | None: ...
38
+
39
+
40
+ class DirectoryProvider:
41
+ def __init__(self, name: str, kind: ProviderKind, root: str | Path) -> None:
42
+ self.name = name
43
+ self.kind = kind
44
+ self.root = Path(root).resolve()
45
+ self._index: dict[str, Path] | None = None
46
+
47
+ def _build(self) -> dict[str, Path]:
48
+ index: dict[str, Path] = {}
49
+ for path in sorted(self.root.rglob("*.md")):
50
+ try:
51
+ prefix = path.read_text(encoding="utf-8")[:512]
52
+ except (OSError, UnicodeDecodeError):
53
+ continue
54
+ match = XID_RE.search(prefix)
55
+ if not match:
56
+ continue
57
+ xid = match.group(1).upper()
58
+ if xid in index:
59
+ raise ValueError(f"duplicate XID in provider {self.name}: {xid}")
60
+ index[xid] = path
61
+ return index
62
+
63
+ def get(self, xid: str) -> Resource | None:
64
+ if self._index is None:
65
+ self._index = self._build()
66
+ path = self._index.get(xid.upper())
67
+ if path is None:
68
+ return None
69
+ data = path.read_bytes()
70
+ return Resource(
71
+ xid=xid.upper(),
72
+ body=data.decode("utf-8"),
73
+ content_hash=_hash_bytes(data),
74
+ provider=self.name,
75
+ provider_kind=self.kind,
76
+ path=str(path),
77
+ )
78
+
79
+
80
+ class StaticProvider:
81
+ def __init__(self, name: str, kind: ProviderKind, resources: dict[str, str]) -> None:
82
+ self.name = name
83
+ self.kind = kind
84
+ self._resources = {xid.upper(): body for xid, body in resources.items()}
85
+
86
+ def get(self, xid: str) -> Resource | None:
87
+ body = self._resources.get(xid.upper())
88
+ if body is None:
89
+ return None
90
+ return Resource(
91
+ xid=xid.upper(),
92
+ body=body,
93
+ content_hash=_hash_bytes(body.encode("utf-8")),
94
+ provider=self.name,
95
+ provider_kind=self.kind,
96
+ )
97
+
98
+
99
+ class CompiledContractProvider(StaticProvider):
100
+ """Resolve compact base-runtime XIDs from installed package resources."""
101
+
102
+ @classmethod
103
+ def installed(cls) -> "CompiledContractProvider":
104
+ base = resources.files("xrefkit").joinpath("resources/base")
105
+ current_file = base.joinpath("current.json")
106
+ if not current_file.is_file():
107
+ raise ValueError("installed base runtime is missing current.json")
108
+ pointer = json.loads(current_file.read_text(encoding="utf-8"))
109
+ generation = str(pointer["generation"])
110
+ if not re.fullmatch(r"[0-9a-f]{16}", generation):
111
+ raise ValueError("invalid installed base runtime generation")
112
+ contract_file = base.joinpath("generations", generation, "contracts.json")
113
+ compiled = json.loads(contract_file.read_text(encoding="utf-8"))
114
+ obligations_by_xid: dict[str, list[dict[str, object]]] = {}
115
+ for obligation in compiled.get("obligations", []):
116
+ obligations_by_xid.setdefault(obligation["source_xid"], []).append(obligation)
117
+ bodies: dict[str, str] = {}
118
+ for source in compiled.get("sources", []):
119
+ xid = source["xid"]
120
+ bodies[xid] = json.dumps(
121
+ {
122
+ "xid": xid,
123
+ "compiled": True,
124
+ "source_hash": source["source_hash"],
125
+ "obligations": obligations_by_xid.get(xid, []),
126
+ },
127
+ ensure_ascii=False,
128
+ sort_keys=True,
129
+ )
130
+ return cls("package-base", "package", bodies)
131
+
132
+
133
+ class ProviderResolver:
134
+ def __init__(
135
+ self,
136
+ mode: ResolverMode,
137
+ providers: list[ResourceProvider],
138
+ *,
139
+ base_xids: set[str] | None = None,
140
+ allowed_shadows: dict[str, str] | None = None,
141
+ ) -> None:
142
+ self.mode = mode
143
+ self.providers = providers
144
+ self.base_xids = {xid.upper() for xid in (base_xids or set())}
145
+ self.allowed_shadows = {xid.upper(): provider for xid, provider in (allowed_shadows or {}).items()}
146
+ self._validate_graph()
147
+
148
+ def _validate_graph(self) -> None:
149
+ kinds = [provider.kind for provider in self.providers]
150
+ if self.mode == "mcp_server" and "mcp" in kinds:
151
+ raise ValueError("MCP server resolver must not contain an MCP provider")
152
+ if self.mode == "mcp_only" and any(kind != "mcp" for kind in kinds):
153
+ raise ValueError("mcp_only resolver may contain only MCP providers")
154
+ if self.mode != "mcp_only" and kinds.count("mcp") > 1:
155
+ raise ValueError("at most one MCP fallback provider is allowed")
156
+ if "mcp" in kinds and kinds[-1] != "mcp":
157
+ raise ValueError("MCP provider must be the final fallback")
158
+
159
+ def resolve(self, xid: str) -> Resource:
160
+ key = xid.upper()
161
+ matches = [resource for provider in self.providers if (resource := provider.get(key)) is not None]
162
+ if not matches:
163
+ raise KeyError(f"unknown XID: {key}")
164
+ hashes = {match.content_hash for match in matches}
165
+ if len(hashes) == 1:
166
+ return matches[0]
167
+ if key in self.base_xids:
168
+ raise ValueError(f"base runtime XID conflict cannot be shadowed: {key}")
169
+ winner = self.allowed_shadows.get(key)
170
+ if winner:
171
+ for match in matches:
172
+ if match.provider == winner:
173
+ return match
174
+ raise ValueError(f"declared shadow provider not active for {key}: {winner}")
175
+ names = ", ".join(match.provider for match in matches)
176
+ raise ValueError(f"conflicting XID {key} from providers: {names}")
177
+
178
+
179
+ def verify_compiled_source_freshness(compiled_path: str | Path, repo_root: str | Path) -> list[str]:
180
+ compiled = json.loads(Path(compiled_path).read_text(encoding="utf-8"))
181
+ root = Path(repo_root)
182
+ stale: list[str] = []
183
+ for source in compiled.get("sources", []):
184
+ path = root / source["path"]
185
+ if not path.is_file() or _hash_bytes(path.read_bytes()) != source["source_hash"]:
186
+ stale.append(source["xid"])
187
+ return stale
@@ -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": "e529eb32397297bb3eda2bf8a3d353b93d6283d7fed3ddcdf74905991cefe744"
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": "5d0582dc38dc5e127590393e66b0d0ccd9b21446b58d3122b89d0ddfedb5bc03"
57
+ },
58
+ {
59
+ "xid": "C3A1F78D9B22",
60
+ "path": "docs/core/contracts/080_xrefkit_startup_contract.md",
61
+ "source_hash": "f6572d733b0b77e972af9538c7f9f4e03b7fb35dc5ffcd9e24c8a218c9fb755f"
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,6 @@
1
+ {
2
+ "schema": "xrefkit.base_generation/v1",
3
+ "generation": "7a682a5272907354",
4
+ "contracts": "generations/7a682a5272907354/contracts.json",
5
+ "model_body": "generations/7a682a5272907354/model_body.md"
6
+ }
@@ -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": "e529eb32397297bb3eda2bf8a3d353b93d6283d7fed3ddcdf74905991cefe744"
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": "5d0582dc38dc5e127590393e66b0d0ccd9b21446b58d3122b89d0ddfedb5bc03"
57
+ },
58
+ {
59
+ "xid": "C3A1F78D9B22",
60
+ "path": "docs/core/contracts/080_xrefkit_startup_contract.md",
61
+ "source_hash": "f6572d733b0b77e972af9538c7f9f4e03b7fb35dc5ffcd9e24c8a218c9fb755f"
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