witan-core
Shared core for the two witan MCP servers — witan (dist witan-council,
mcp/servers/witan) and witan-code (mcp/servers/witan-code). It is the third
shared packages/ sibling alongside
agent-config-kit, wired into both servers via
a [tool.uv.sources] editable path (dev/CI) plus a published PyPI version range.
Why
The two servers were built copy-paste-and-diverge and carried an explicit "deliberately duplicated — no cross-package import" convention. As the shared surface grew, fixes had to be applied twice and silently drifted — including code that is contractually required to stay identical (the repo-key canonicalizer behind the cross-layer symbol join key; the pinned omnigraph binary version, kept in lockstep by a fragile Renovate custom manager).
witan-core deliberately reverses that convention. The full rationale, scope,
and per-extraction contracts live in
docs/internals/design/witan-core-extraction-spec.md.
Invariant
witan_core imports neither witan nor witan_code. It is a leaf below
both, preserving the one-directional witan → witan_code optional-mount DAG
(witan mounts witan-code as witan code; witan-code never imports witan).
Dependencies
The base package is stdlib-only. Heavier concerns are gated behind extras so neither server pulls weight it doesn't use:
witan-core[cli]→cyclopts,rich,agent-config-kit(CLI scaffolding, styled installer output)witan-core[mcp]→fastmcp(MCP elicitation primitives)witan-core[remote]→httpx2,fastmcp(the ADR-0005 client stack: OIDC device-auth + token cache, and the MCP-client proxy)witan-core[observability]→structlog, OpenTelemetry (structured logs and traces; the OTel halves are imported defensively so an install without an exporter still works)witan-core[sentry]→sentry-sdk
sentry is additive to observability, not an alternative to it:
telemetry.py imports observability.logging, which imports structlog at
module scope, so sentry on its own is an ImportError rather than a lighter
build. The split lets a deployment take logs and traces without shipping
errors to Sentry, not the reverse. Both servers request both.
What's here
Extracted so far (each deletes the duplicated copies from both servers):
_detach.popen_detached— cross-platform detached subprocess spawningomnigraph_install— the pinned-omnigraph-binary installer (single source of the version;richimported lazily)elicit— theconfirm/textMCP elicitation primitives (needs themcpextra; not re-exported from the package root)repo_key—normalise+find_git_config, the cross-layer repo-key canonicalizer, with a golden contract testtimeutil.now_isomaintenance— the throttled-optimize stamp/interval/due mechanicsomnigraph.OmnigraphClient— the omnigraph-CLI subprocess wrapper base (write lock, retry/repair, admission-cap backoff); each server subclasses it (witan addsapply_schema; witan-code adds branch ops + bulkload)config_file.load_toml— shared config.toml loading (WITAN_CONFIGenv var). Both servers read the same file, so one[targets.<name>]block can override both at once.target_config— the[targets.<name>]match/select logic:match_target(prioritymatch_paths>match_repos>match_hosts>match_orgs),parse_target_tables,to_list,local_project_path. Each server keeps its own typed target model (different override fields — witan'sserver/graph/token/…, witan-code'scode_dir) and calls into this shared matcher, which is structurally typed over just the fourmatch_*lists.
Later additions, past the original extraction list:
cli— shared CLI scaffolding (make_app,resolve_author,report_install), used by both servers'setupcommands. Needs thecliextra. This is no longer local to each server; what stays local is each server's own commands and setup behaviour.identity— Keycloaksub→ omnigraph actor id (ADR-0004). witan maps the claim server-side off a validated JWT; witan-code maps the same claim client-side off its cached token to name the branch views it owns. One derivation, so the two agree.remote/— the client-side remote-access layer behindwitan login(ADR-0005 path a):config(RemoteConfig),oidc(device-auth grant + shared token cache),proxy(MCP-client proxy). Needs theremoteextra.observability/— structlog configuration plus OpenTelemetry, patterned aftermitol-django-observabilityso witan reports the way the rest of the estate does. Includes the ASGI and MCP middleware andtelemetry.configure_sentry.omnigraph_http— pooled HTTP transport for a deployed omnigraph-server, so a remote read need not pay for a CLI subprocess. Gated byWITAN_OMNIGRAPH_HTTP; the CLI path beneath it stays maintained and is still the only route toload,branch, andoptimize.chunking— splits a bulk load into batches omnigraph-server will accept, rather than dying on a413part-way through a repo-scale index.caching— server-declared cache directives fortools/listand friends (MCP 2026-07-28, SEP-2549), so a client stops re-fetching a surface that only changes on deploy.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file witan_core-0.34.0.tar.gz.
File metadata
- Download URL: witan_core-0.34.0.tar.gz
- Upload date:
- Size: 263.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57f77297b94a7c036b75d33917076ad34306298a031ab15dad6d5e242a6537c1
|
|
| MD5 |
9fcffcfea9094444498ab45e1811e007
|
|
| BLAKE2b-256 |
a5b6dbb7251caf74c05c313422aacd35ee017b127b178932be58f358b7b4e7df
|
Provenance
The following attestation bundles were made for witan_core-0.34.0.tar.gz:
Publisher:
publish-witan-core.yml on mitodl/agent-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
witan_core-0.34.0.tar.gz -
Subject digest:
57f77297b94a7c036b75d33917076ad34306298a031ab15dad6d5e242a6537c1 - Sigstore transparency entry: 2715716824
- Sigstore integration time:
-
Permalink:
mitodl/agent-kit@8c1a6f3e8e925bd38b439df41e5397b131d61031 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mitodl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-witan-core.yml@8c1a6f3e8e925bd38b439df41e5397b131d61031 -
Trigger Event:
push
-
Statement type:
File details
Details for the file witan_core-0.34.0-py3-none-any.whl.
File metadata
- Download URL: witan_core-0.34.0-py3-none-any.whl
- Upload date:
- Size: 151.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e1738a1bd993bad3875e779a9c9bda4031a088ef7ce8990d09a6fb9d9ea3dcb
|
|
| MD5 |
9cfd87a8ac8fbaa69722fca9c9c237af
|
|
| BLAKE2b-256 |
fb042776b32c98691ef1742400f51cf940a6e43cbc51a6b9cac18d1e6756525b
|
Provenance
The following attestation bundles were made for witan_core-0.34.0-py3-none-any.whl:
Publisher:
publish-witan-core.yml on mitodl/agent-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
witan_core-0.34.0-py3-none-any.whl -
Subject digest:
1e1738a1bd993bad3875e779a9c9bda4031a088ef7ce8990d09a6fb9d9ea3dcb - Sigstore transparency entry: 2715716983
- Sigstore integration time:
-
Permalink:
mitodl/agent-kit@8c1a6f3e8e925bd38b439df41e5397b131d61031 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mitodl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-witan-core.yml@8c1a6f3e8e925bd38b439df41e5397b131d61031 -
Trigger Event:
push
-
Statement type: