Skip to main content

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 spawning
  • omnigraph_install — the pinned-omnigraph-binary installer (single source of the version; rich imported lazily)
  • elicit — the confirm/text MCP elicitation primitives (needs the mcp extra; not re-exported from the package root)
  • repo_key — normalise + find_git_config, the cross-layer repo-key canonicalizer, with a golden contract test
  • timeutil.now_iso
  • maintenance — the throttled-optimize stamp/interval/due mechanics
  • omnigraph.OmnigraphClient — the omnigraph-CLI subprocess wrapper base (write lock, retry/repair, admission-cap backoff); each server subclasses it (witan adds apply_schema; witan-code adds branch ops + bulk load)
  • config_file.load_toml — shared config.toml loading (WITAN_CONFIG env 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 (priority match_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's server/graph/token/…, witan-code's code_dir) and calls into this shared matcher, which is structurally typed over just the four match_* lists.

Later additions, past the original extraction list:

  • cli — shared CLI scaffolding (make_app, resolve_author, report_install), used by both servers' setup commands. Needs the cli extra. This is no longer local to each server; what stays local is each server's own commands and setup behaviour.
  • identity — Keycloak sub → 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 behind witan login (ADR-0005 path a): config (RemoteConfig), oidc (device-auth grant + shared token cache), proxy (MCP-client proxy). Needs the remote extra.
  • observability/ — structlog configuration plus OpenTelemetry, patterned after mitol-django-observability so witan reports the way the rest of the estate does. Includes the ASGI and MCP middleware and telemetry.configure_sentry.
  • omnigraph_http — pooled HTTP transport for a deployed omnigraph-server, so a remote read need not pay for a CLI subprocess. Gated by WITAN_OMNIGRAPH_HTTP; the CLI path beneath it stays maintained and is still the only route to load, branch, and optimize.
  • chunking — splits a bulk load into batches omnigraph-server will accept, rather than dying on a 413 part-way through a repo-scale index.
  • caching — server-declared cache directives for tools/list and friends (MCP 2026-07-28, SEP-2549), so a client stops re-fetching a surface that only changes on deploy.

Release files for witan-core 0.38.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for witan-core 0.38.0
File Size Uploaded
witan_core-0.38.0.tar.gz 285.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for witan-core 0.38.0
File Interpreter ABI Platform
witan_core-0.38.0-py3-none-any.whl Python 3 none any Details

Total release size: 447.9 kB

Release files / witan_core-0.38.0.tar.gz

Download URL witan_core-0.38.0.tar.gz
Size 285.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6d01c0a9c4ef53e271b765254686299bfaa2a106fd8c403ef810aed7cc890171
BLAKE2b-256 checksum
How to use checksums
2efc24e822b5fcfe2b40dadf24f5e9079318ec8743d1517843b689ae816e8a0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / witan_core-0.38.0-py3-none-any.whl

Download URL witan_core-0.38.0-py3-none-any.whl
Size 162.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2ff4818254922f3c8831bcd9cb1dc0854c58c76f626144c9f5daa958908e961
BLAKE2b-256 checksum
How to use checksums
a8d0a41495e4d2ac3e381c8088fa94bdfa27e5d7dca0693a46184b2407de81bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.40.0

2 release files

0.39.0

2 release files

This release

0.38.0 This release

2 release files

0.37.0

2 release files

0.36.0

2 release files

0.35.0

2 release files

0.32.2

2 release files

0.32.1

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.28.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page