A network of agentic research specialists coordinated by a principal investigator agent. V1: web-search researcher MCP server + CLI shim.
Find a file
Jeff Smith 8a62f6b014 M2.5.1: Structured application logger via structlog (#24)
Adds an operational logging layer separate from the JSONL trace
audit logs. Operational logs cover system events (startup, errors,
MCP transport, research lifecycle); JSONL traces remain the
researcher provenance audit trail.

Backend: structlog with two renderers selectable via
MARCHWARDEN_LOG_FORMAT (json|console). Defaults to console when
stderr is a TTY, json otherwise — so dev runs are human-readable
and shipped runs (containers, automation) emit OpenSearch-ready
JSON without configuration.

Key features:
- Named loggers per component: marchwarden.cli,
  marchwarden.mcp, marchwarden.researcher.web
- MARCHWARDEN_LOG_LEVEL controls global level (default INFO)
- MARCHWARDEN_LOG_FILE=1 enables a 10MB-rotating file at
  ~/.marchwarden/logs/marchwarden.log
- structlog contextvars bind trace_id + researcher at the start
  of each research() call so every downstream log line carries
  them automatically; cleared on completion
- stdlib logging is funneled through the same pipeline so noisy
  third-party loggers (httpx, anthropic) get the same formatting
  and quieted to WARN unless DEBUG is requested
- Logs to stderr to keep MCP stdio stdout clean

Wired into:
- cli.main.cli — configures logging on startup, logs ask_started/
  ask_completed/ask_failed
- researchers.web.server.main — configures logging on startup,
  logs mcp_server_starting
- researchers.web.agent.research — binds trace context, logs
  research_started/research_completed

Tests verify JSON and console formats, contextvar propagation,
level filtering, idempotency, and auto-configure-on-first-use.
94/94 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 15:46:51 -06:00
cli M2.5.1: Structured application logger via structlog (#24) 2026-04-08 15:46:51 -06:00
obs M2.5.1: Structured application logger via structlog (#24) 2026-04-08 15:46:51 -06:00
orchestrator Initial project structure and scaffolding 2026-04-08 11:57:15 -06:00
researchers M2.5.1: Structured application logger via structlog (#24) 2026-04-08 15:46:51 -06:00
scripts Propagate parent env to MCP server subprocess (#18) 2026-04-08 15:31:14 -06:00
tests M2.5.1: Structured application logger via structlog (#24) 2026-04-08 15:46:51 -06:00
.dockerignore chore: add docker-based test environment (#13) 2026-04-08 15:06:12 -06:00
.gitignore Initial project structure and scaffolding 2026-04-08 11:57:15 -06:00
CLAUDE.md chore: add CLAUDE.md for session 1 2026-04-08 14:44:16 -06:00
CONTRIBUTING.md Initial project structure and scaffolding 2026-04-08 11:57:15 -06:00
Dockerfile chore: add docker-based test environment (#13) 2026-04-08 15:06:12 -06:00
pyproject.toml M2.5.1: Structured application logger via structlog (#24) 2026-04-08 15:46:51 -06:00
README.md chore: add docker-based test environment (#13) 2026-04-08 15:06:12 -06:00

Marchwarden

A network of agentic research specialists coordinated by a principal investigator agent.

Marchwarden researchers are stationed at the frontier of knowledge — they watch, search, synthesize, and report back what they find. Each specialist is self-contained, fault-tolerant, and exposed via MCP. The PI agent orchestrates them to answer complex, multi-domain questions.

V1: Single web-search researcher + CLI shim for development.
V2+: Multiple specialists (arxiv, database, internal docs, etc.) + PI orchestrator.

Quick start

# Clone
git clone https://forgejo.labbity.unbiasedgeek.com/archeious/marchwarden.git
cd marchwarden

# Install
pip install -e .

# Ask a question
marchwarden ask "What are ideal crops for a garden in Utah?"

# Replay a research session
marchwarden replay <trace_id>

Docker test environment

A reproducible container is available for running the test suite and the CLI without depending on the host's Python install:

scripts/docker-test.sh build           # build the image
scripts/docker-test.sh test             # run pytest
scripts/docker-test.sh ask "question"   # run `marchwarden ask` end-to-end
                                        # (mounts ~/secrets ro and ~/.marchwarden rw)
scripts/docker-test.sh replay <id>      # replay a trace from ~/.marchwarden/traces
scripts/docker-test.sh shell            # interactive bash in the container

Documentation

Status

  • V1 scope: Issue #1
  • Branch: main (development)
  • Tests: pytest tests/

Stack

License

(TBD)