Module Map.mdc

Module map

Views3
PublishedMay 30, 2026

Loading actions...

5 minBeginnerpromptSingle file

Skill content

Main instructions and any bundled files for this skill.

markdown

src/bernstein/core/ - orchestration engine

FilePurpose
compat_redirect_ledger.pyCompatibility ledger for legacy bernstein.core redirects
credential_scoping.pyAgent credential scope minimization for least-privilege API keys
dataclass_helpers.pyHelpers for preserving dataclass instance types through updates
defaults.pyCentralized default values for the Bernstein orchestrator
streaming_merge.pyStreaming task results for long-running agents (incremental merge)
agents/agents sub-package
approval/Interactive tool-call approval (op-002)
autofix/Bernstein autofix daemon - auto-repair CI failures on Bernstein PRs
autoheal/Auto-heal v2 subpackage
chat/Chat-control bridges for driving Bernstein agents from messaging apps
communication/communication sub-package
compliance/Compliance subpackage
config/Config: seed parsing, config management, settings, feature gates
cost/cost sub-package
daemon/Daemon installation helpers for Bernstein
devops/devops sub-package
distribution/Distribution utilities - air-gap wheelhouse build, verify, signing
errors/Structured first-run error categorization for Bernstein
fleet/Fleet dashboard - supervise multiple Bernstein projects in one view
git/git sub-package
grpc_gen/Generated gRPC stubs - run scripts/generate_proto.sh to populate
handoff/Session handoff between terminal and chat/dashboard surfaces (op-005)
identity/Install-rev identity module - passive, operator-decodable install fingerprint
integrations/Integrations sub-package
interop/Cross-organisation interoperability surfaces
knowledge/knowledge sub-package
lifecycle/Lifecycle-hooks subsystem
lineage/Lineage v1 - Sigstore-style per-artefact transparency log
memory/memory sub-package - persistent memory stores
notifications/Outbound notification subsystem (release 1.9)
observability/observability sub-package
orchestration/orchestration sub-package
persistence/persistence sub-package
planning/planning sub-package
plugins_core/plugins_core sub-package
preview/bernstein preview - sandboxed dev-server with public tunnel link
protocols/protocols sub-package
quality/quality sub-package
replay/Deterministic replay package for Bernstein agent runs
review/Per-adapter perspective assignment and chain coordination for reviews
review_responder/PR review responder - react to inline review comments on Bernstein PRs
routes/FastAPI router modules for the Bernstein task server
routing/routing sub-package
sandbox/Pluggable sandbox backends for agent isolation (oai-002 phase 1)
security/security sub-package
server/server sub-package - re-exports for backward compatibility
sessions/Session-level orchestration primitives that span multiple subsystems
simulate/Digital-twin orchestration simulator (issue #1374)
skills/Progressive-disclosure skill packs (oai-004)
storage/Pluggable artifact storage sinks (oai-003)
substrate/Substrate: register Bernstein into host applications (MCP servers, etc.)
tasks/tasks sub-package
telemetry/Opt-in operator observability for Bernstein
tokens/tokens sub-package
trackers/Tracker adapter subsystem
trigger_sources/Trigger source adapters - normalize raw events into TriggerEvent
tunnels/Tunnel provider abstraction and registry
workflows/Archon-inspired YAML workflow manifests
worktrees/Worktree inventory and garbage-collection helpers

src/bernstein/adapters/ - CLI agent adapters

FilePurpose
_contract.pyAdapter contract loader and capability checker
aichat.pyAIChat CLI adapter
aider.pyAider CLI adapter
amp.pyAmp CLI adapter
auggie.pyAuggie (Augment Code) CLI adapter
autohand.pyAutohand Code CLI adapter
base.pyBase adapter for CLI coding agents
caching_adapter.pyCaching wrapper for CLI adapters to enable prompt prefix deduplication and response reuse
charm.pyCharm Crush CLI adapter
claude.pyClaude Code CLI adapter
claude_agents.pyBuild per-task Claude Code subagent definitions for the --agents flag
claude_cache_control.pyAnthropic API cache-control block builder for the Claude Code adapter
claude_exit_codes.pyMap Claude Code exit codes to Bernstein AbortReason/TransitionReason
claude_mcp_loader.pyMCP config loading and merging for the Claude Code adapter
claude_routine.pyClaude Code Routine adapter - offloads tasks to Anthropic cloud via /fire API
claude_stream_parser.pyParse Claude Code --output-format stream-json events
claude_wrapper_script.pyInline wrapper script source + assembly for the Claude Code adapter
cline.pyCline CLI adapter
clm.pyCLM sovereign LLM adapter - drives a customer-side CLM gateway
clm_tls_launcher.pymTLS launcher for the CLM adapter
cloudflare_agents.pyCloudflare Agents SDK adapter for local wrangler dev or deployed worker trigger
codebuff.pyCodebuff CLI adapter
codex.pyOpenAI Codex CLI adapter
codex_cloudflare.pyCodex adapter for Cloudflare Sandbox execution
cody.pySourcegraph Cody CLI adapter
composio.pyComposio Agent Orchestrator (ao) CLI adapter
conformance.pyAdapter tool contract conformance suite harness
continue_dev.pyContinue.dev CLI adapter
copilot.pyGitHub Copilot CLI adapter
cursor.pyCursor Agent CLI adapter
devin_terminal.pyDevin for Terminal (Cognition) CLI adapter
droid.pyDroid (Factory AI) CLI adapter
env_isolation.pyEnvironment variable isolation for spawned agents
forge.pyForge CLI adapter
gemini.pyGoogle Gemini / Antigravity CLI adapter
generic.pyGeneric CLI adapter for arbitrary coding agent CLIs
goose.pyGoose CLI adapter for Bernstein
gptme.pygptme CLI adapter
hermes.pyHermes Agent (Nous Research) CLI adapter
iac.pyInfrastructure-as-Code (Terraform/Pulumi) adapter for Bernstein
junie.pyJetBrains Junie CLI adapter
kilo.pyKilo CLI adapter (Stackblitz)
kimi.pyKimi CLI adapter
kiro.pyKiro CLI adapter
letta_code.pyLetta Code CLI adapter
manager.py
mistral.pyMistral Vibe CLI adapter
mock.pyMock CLI adapter for zero-API-key demos and testing
ollama.pyOllama / OpenAI-compatible local LLM adapter - run coding agents without cloud API keys
open_interpreter.pyOpen Interpreter CLI adapter
openai_agents.pyOpenAI Agents SDK v2 adapter
openai_agents_runner.pyPython entrypoint that runs an OpenAI Agents SDK session
opencode.pyOpenCode CLI adapter
openhands.pyOpenHands CLI adapter
pi.pyPi (pi-coding-agent) CLI adapter
plandex.pyPlandex CLI adapter
plugin_sdk.pyAdapter plugin SDK for third-party agent integration
q_dev.pyAWS Q Developer CLI adapter (binary: q)
qwen.pyQwen CLI adapter for OpenAI compatible models
ralphex.pyRalphex (umputun/ralphex) CLI adapter
registry.pyAdapter registry - look up CLI adapters by name
report.pyAdapter conformance + capability report
rovo.pyAtlassian Rovo Dev CLI adapter
session_id.pyDeterministic session-id binding for adapter replay isolation
skills_injector.pyInject per-task Claude Code skills into the worktree before spawn
strict_schema.pyStrict structured-output validation and user-owned-field protection
use_cases.pyPer-adapter metadata for the bernstein integrations list command
ci/CI system adapters for log parsing and failure extraction

src/bernstein/agents/ - agent catalog & discovery

FilePurpose
agency_provider.pyAgencyProvider - loads CatalogAgent instances from msitarzewski/agency-agents format
catalog.pyAgent catalog registry - loads agent definitions from external sources
discovery.pyAgent directory auto-discovery for Bernstein
registry.pyDynamic agent registry with YAML-based definitions and hot-reload support

src/bernstein/cli/ - Click CLI

FilePurpose
api_warmup.pyAPI preconnect warmup -- send a minimal request to warm provider connections
badge.pyPowered-by badge helper for bernstein init --add-badge
commit_stats.pyCommit attribution stats: gather per-role commit stats via git log
dashboard.pyBernstein TUI -- retro-futuristic agent orchestration dashboard
dashboard_actions.pyDashboard side panels and expert views
dashboard_app.pyBernstein TUI application -- main App class and entry point
dashboard_header.pyDashboard header and agent display widgets
dashboard_polling.pyDashboard polling helpers, data loaders, formatters, and constants
debug_bundle.pyDebug bundle export -- bernstein debug bundle
first_run_guard.pyFirst-run guard helpers wiring categorisation into CLI entry points
helpers.pyShared constants, helpers, and utilities for Bernstein CLI modules
install_check.pyInstallation mismatch detection -- detect multiple Bernstein installs and config conflicts
keybindings.pyKeybinding system for the Bernstein TUI
live.pyLive view helpers for bernstein live --classic
main.pyCLI entry point for Bernstein -- declarative agent orchestration
notebook_traces.pyNotebook-aware traces - detect and track Jupyter notebook cell edits
release_notes.pyRelease notes display - fetch and format CHANGELOG.md for terminal output
run.pyEnhanced run output for bernstein run
run_archive.pyExport full run archive as ZIP
run_bootstrap.pyMain Click commands and execution bootstrap for Bernstein runs
run_cmd.pyRun commands: init, conduct, downbeat (legacy start), and the main CLI group
run_confirm.pyRecipe/cook commands, demo, and confirmation helpers for Bernstein runs
run_names.pyMemorable deterministic run names for user-facing surfaces (#1626)
run_preflight.pyPreflight cost estimation and runtime warnings for Bernstein runs
settings_snapshot.pySettings snapshot - capture and serialize effective settings for traces
side_query.pySide-question ("btw") protocol for non-blocking agent queries
status.pyFormatted status output for bernstein status
transcript_search.pySearch across agent transcript/trace files in .sdd/traces/
ui.pyShared Rich UI components for Bernstein CLI
usage_provisioning.pyUsage budget tracking and overage detection for Bernstein
commands/commands sub-package
display/ui sub-package
doctor/Bernstein doctor sub-package - extended diagnostic checks
plan/plan sub-package
scaffold/Bernstein scaffold subsystem
utils/utils sub-package

src/bernstein/evolution/ - self-evolution engine

FilePurpose
_shared.pyShared constants, data classes, and helpers for the evolution loop modules
aggregator.pyMetrics aggregation with EWMA, CUSUM, BOCPD, and Goodhart defenses
applicator.pyChange applicator - execute upgrades via file modification
benchmark.pyTiered benchmark runner for evolution validation
circuit.pyCircuitBreaker - halt evolution when safety conditions are violated
creative.pyCreative evolution pipeline - visionary → analyst → production gate
cycle_helpers.pyEvolution cycle helper logic - community, creative, and GitHub sync
cycle_runner.pyEvolution cycle execution engine
data_collector.pyMetric record types and file-based metrics collection for the evolution system
detector.pyOpportunity detection from aggregated metrics
gate.pyApprovalGate and EvalGate - risk-stratified routing for evolution proposals
governance.pyAdaptive governance for the evolution system
invariants.pyInvariantsGuard - hash-lock safety-critical files
loop.pyAutoresearch evolution loop - continuous self-improvement via experiment cycles
oscillation_guard.pyOscillation guard for prompt-evolution proposals
predicted_delta.pyPredicted-delta gate for prompt-evolution proposals
proposal_scorer.pyProposal risk scoring and routing classification
proposals.pyUpgrade proposal generation
report.pyEvolution observability - history table and static report generation
report_generator.pyAnalysis result types, statistical helpers, and Goodhart's Law defenses
risk.pyStrategic Risk Score (SRS) computation for evolution proposals
sandbox.pySandboxValidator - isolated testing of evolution proposals
types.pyShared types for the evolution system

src/bernstein/eval/ - evaluation harness

FilePurpose
ab_runner.pyA/B runner primitive - deterministic prompt-vs-prompt comparison
baseline.pyBaseline tracking for eval-gated evolution
calibration.pyCalibration log + Brier score for router and judge decisions
golden.pyGolden benchmark suite - curated tasks for eval
harness.pyEval harness - multiplicative scoring, LLM judge, failure taxonomy
incident_synthesizer.pyConvert dead-letter and post-mortem incidents into regression eval cases
judge.pyLLM judge - evaluate code quality of agent-produced changes
metrics.pyCustom eval metrics - each metric is a dataclass with a compute method
pentest_consensus.pyConsensus aggregation for the multi-adapter pentest fan-out
pentest_runner.pyDriver that runs the security-pentest scenario end-to-end
pentest_scorer.pyPrecision and recall scorer for security pentest eval scenario
scenario_generator.pyForward-looking synthetic scenario generator
scenario_runner.pyScenario runner - execute YAML-defined eval scenarios against the live codebase
taxonomy.pyFailure taxonomy - classify every eval failure into a closed set
telemetry.pyTelemetry contract - strict schema for agent output metadata
vcr_fixture.pyVCR fixture pattern - dehydrate/hydrate deterministic test fixtures (T805)
yaml_runner.pyYAML eval harness - operator-runnable spec format with judge and golden diff
golden_data/Packaged golden benchmark fixtures (ships in wheel via package-data)

src/bernstein/plugins/ - plugin system (pluggy)

FilePurpose
hookspecs.pyHook specifications - defines extension points for Bernstein plugins
manager.pyPlugin manager - discovers, loads, and invokes Bernstein plugins
permission_explain.pyProgressive disclosure for permission requests -- explain-before-approve mode
plugin_errors.pyPlugin error collection and reporting
plugin_trust.pyPlugin trust checking and risk scoring for Bernstein plugins
security_review.pySecurity review: regex-based pattern scanning for agent-produced diffs

src/bernstein/tui/ - Textual TUI

FilePurpose
accessibility.pyTUI-013: Accessibility mode for the Bernstein TUI
activity_tracker.pyActivity tracking metrics with duration accounting
agent_duration.pyAgent duration display for TUI agent panel
agent_log.pyLog and quality gate widgets for the Bernstein TUI
agent_states.pyTUI-005: Visual distinction for agent states
app.pyMain Textual application for the Bernstein TUI session manager
approval_panel.pyApproval, waterfall, tool observer, and SLO widgets for the Bernstein TUI
away_summary.pyAway summary generation for orchestration recap
clipboard.pyTUI-007: Copy-to-clipboard for task IDs, agent logs, error messages
color_mode.pyTerminal color mode detection - auto-detect truecolor/256-color/ANSI
command_palette.pyCommand palette with fuzzy search for TUI actions
context_files_doctor.pyContext warnings for bernstein doctor -- detect stale configs, bad files, MCP issues
context_tokens.pyContext token accounting - analyze where context budget is spent
contextual_tips.pyContextual tips system with cooldown for Bernstein CLI
cost_sparkline.pyTUI-006: Cost sparkline for the TUI sidebar
dependency_graph.pyASCII-art dependency graph renderer for tasks
diff_folding.pyDiff folding - collapsible diff display for large changes
diff_render.pyWord-level diff rendering for Bernstein TUI
fallback.pyRich-based fallback display for unsupported terminals (TUI-003)
help_screen.pyHelp screen modal for TUI - shortcuts plus discoverability hints
keybinding_config.pyTUI-004: Configurable keybinding system with YAML-based key map
layout_cache.pyDirty-flag layout caching - skip layout recalculation when nothing changed
layout_persistence.pyPersistent layout customization and presets for the Bernstein TUI
log_viewer.pySyntax highlighting, diff folding, and markdown rendering for agent logs
mouse_support.pyTUI-017: Mouse support for panel interaction
notification_badge.pyTUI-020: Notification badge for background events
output_styles.pyOutput style customization -- load per-project agent output format preferences
progress_bar.pyTUI-010: Task progress bar with completion percentage
scheduling_panel.pyScheduling panel widget for TUI - visualizes scheduling decisions
session_analytics.pySession analytics - analyze task traces for insights
session_recorder.pyTUI-019: Session recording and playback
session_rename.pySession rename functionality - rename the current session safely
session_tags.pySession tag system - add searchable tags to the current orchestration session
snapshot_testing.pyTUI visual regression snapshot testing utilities
split_pane.pyTUI-008: Split-pane view (tasks list + live agent log)
status_bar.pyStatus, scratchpad, and coordinator widgets for the Bernstein TUI
task_context.pyTask context panel for the Bernstein TUI
task_detail_overlay.pyTUI-018 / UX-006: Task detail overlay with tabbed sections
task_list.pyTask display widgets and constants for the Bernstein TUI
task_search.pyTask search, filter parsing, and input widget for the TUI
themes.pyTUI-011: Dark/light theme support
timeline.pyTimeline view of task execution for the Bernstein TUI
toast.pyTUI-009: Notification toast for events
tokens.pyPer-agent token usage tracker - lightweight thread-safe token accounting
vim_mode.pyTUI-014: Vim-mode keybindings for TUI navigation
widgets.pyCustom Textual widgets for the Bernstein TUI
worker_badges.pyWorker badge identity module - format worker metadata into Rich badge strings
worktree_status.pyCompact runtime and worktree health pane for the Bernstein TUI

src/bernstein/github_app/ - GitHub App integration

FilePurpose
app.pyGitHub App authentication: JWT creation and installation token exchange
check_runs.pyGitHub Check Runs API client
ci_router.pyCI failure routing: blame attribution and enriched fix-task generation
cost_reporter.pyPR cost annotation: post agent run cost summaries as GitHub PR comments
mapper.pyEvent-to-task conversion: maps GitHub webhook events to Bernstein task payloads
slash_commands.pySlash command parser for /bernstein comments on GitHub issues and PRs
webhooks.pyWebhook parsing and HMAC-SHA256 signature verification

src/bernstein/mcp/ - MCP server

FilePurpose
capability.pyRuntime capability cards for the Bernstein MCP server
cost_meter.pyPer-call cost-meter and observability envelope for MCP tool responses
input_validation.pySchema-validated MCP tool-call inputs with deny-by-default
oauth.pyOAuth-2 / OIDC discovery metadata for the Bernstein MCP server
prompts.pyBuilt-in MCP prompts for the Bernstein server
remote_transport.pyStreamable HTTP transport for Bernstein MCP server
routine_tools.pyMCP tools for the rt-003 Routine <-> Scenario bridge
server.pyBernstein MCP server
streaming.pyIn-flight tool-call tracking with cancellation and partial-result preservation
resources/MCP resource registrars for Bernstein
tool_schemas/tool_schemas/ sub-package

src/bernstein/benchmark/ - SWE-bench

FilePurpose
comparative.pyComparative Benchmark Suite for Bernstein
golden.pyGolden test suite for the Bernstein orchestrator
programbench.pyProgramBench evaluation harness for Bernstein
reproducible.pyReproducible benchmark suite for Bernstein
swe_bench.pySWE-Bench evaluation harness for Bernstein

Key non-package directories

PathPurpose
templates/roles/Jinja2 role prompts (manager, backend, qa, security, devops, etc.)
templates/prompts/Prompt templates (judge.md, etc.) - bundled into wheel
.sdd/All runtime state (never commit .sdd/runtime/)
.sdd/backlog/open/YAML task specs waiting to be picked up
.sdd/backlog/claimed/Tasks currently being worked
.sdd/backlog/closed/Completed/cancelled tasks
.sdd/runtime/PIDs, logs, session state, signal files
.sdd/metrics/JSONL metric records
.sdd/traces/JSONL agent traces
.sdd/agents/catalog.jsonRegistered agent catalog
tests/unit/Fast unit tests (no network)
tests/integration/Integration tests (require running server)
scripts/run_tests.pyPer-file isolated test runner
Share: