Skip to content

Repository files navigation

logic

Atomic logic for decision-making. Turning abstract ideas into executable functions.

Ship decisions, not spreadsheets.

A modular toolkit built with FastAPI and SQLAlchemy. Open source decision-making tools for the global PM/PMO community — every experiment, every formula, every line of code becomes a public deliverable.

The OSS is the free tier of value. Full-strength tools — importable Python, Claude Skills, an MCP server (pmorun-mcp on PyPI) and open plugin interfaces — not a crippled trial. What sits behind a contract is the intelligence layer: analysis and insights, proprietary calibration plugins, and a managed data layer. The maths is never behind a paywall.

Philosophy

  • Executable: Ideas are just hypotheses until they're code.
  • Composable: Functions designed to be imported or piped.
  • Lean: External dependencies are a last resort.
  • Simple: Fewer managed entities, more computed insights.
  • Privacy by design: Explicit data zones with transparent boundaries.

Modules

Every module follows: Standalone PoC → FastAPI endpoint → Agent tool → Interactive UI

Finance — "What will it cost and is it worth it?"

Module Status Description
TCO ✅ Live Total Cost of Ownership with NPV adjustment
NPV 📋 Planned Net Present Value analysis
IRR 📋 Planned Internal Rate of Return
ROI 📋 Planned Return on Investment

Performance — "How long will it take and are we on track?"

Module Status Description
PERT ✅ Live Three-point estimation with reality adjustments
Monte Carlo ✅ Live Probabilistic schedule simulation (P50/P80/P95)
EVM ✅ Live Earned Value Management (SV, SPI, CV, CPI, EAC, TCPI)
Bayesian ✅ Live Bayesian estimation calibration from actuals
Base-rate 📋 Planned Reference class forecasting

Value Delivery — "Are we delivering value?"

Module Status Description
Flow Metrics 📋 Planned Cycle time, throughput, WIP analysis

Quick Start

git clone https://github.com/lemur47/logic.git && cd logic
sudo apt install gitleaks
uv venv
direnv allow
uv pip install -e ".[dev]"
pre-commit install
uv run uvicorn app.main:app --reload   # API at http://127.0.0.1:8000

API Endpoints

TCO

POST   /tco/calculate          Calculate TCO (stateless)
POST   /tco/compare            Compare options, ranked by annual cost
POST   /tco/breakeven          Break-even analysis between two options
POST   /tco/scenarios          Save a scenario
GET    /tco/scenarios          List scenarios (paginated, searchable)
GET    /tco/scenarios/{id}     Get a scenario
PATCH  /tco/scenarios/{id}     Update a scenario (auto-recalculates)
DELETE /tco/scenarios/{id}     Delete a scenario
GET    /tco/scenarios/stats    Aggregate statistics

PERT

POST   /pert/task              Single-task PERT estimate (with optional insight tags)
POST   /pert/project           Multi-task project estimation
POST   /pert/scenarios         Save a scenario
GET    /pert/scenarios         List scenarios (paginated, searchable)
GET    /pert/scenarios/{id}    Get a scenario
PATCH  /pert/scenarios/{id}    Update a scenario (auto-recalculates)
DELETE /pert/scenarios/{id}    Delete a scenario

Monte Carlo

POST   /montecarlo/simulate               Probabilistic schedule simulation (stateless)
POST   /montecarlo/simulate/target        Probability of completion within a target (stateless)
POST   /montecarlo/scenarios              Save a scenario
GET    /montecarlo/scenarios              List scenarios (paginated, searchable)
GET    /montecarlo/scenarios/stats        Aggregate statistics
GET    /montecarlo/scenarios/{id}         Get a scenario
PATCH  /montecarlo/scenarios/{id}         Update a scenario (auto-resimulates)
DELETE /montecarlo/scenarios/{id}         Delete a scenario

EVM

POST   /evm/calculate                     Calculate EVM metrics (stateless)
POST   /evm/health                        Health signal from SPI/CPI (stateless)
POST   /evm/baselines                     Create a project baseline
GET    /evm/baselines                     List baselines (paginated, searchable)
GET    /evm/baselines/{id}                Get a baseline
DELETE /evm/baselines/{id}                Delete a baseline
POST   /evm/baselines/{id}/evaluate       Evaluate progress against baseline
GET    /evm/baselines/{id}/snapshots      List evaluation snapshots

Bayesian

POST   /bayesian/calculate                      Compute posterior (stateless)
POST   /bayesian/adjust                         Apply delay factor to PERT estimate (stateless)
POST   /bayesian/contexts                       Create an estimation context
GET    /bayesian/contexts                       List contexts (paginated, searchable)
GET    /bayesian/contexts/{id}                  Get a context
DELETE /bayesian/contexts/{id}                  Delete a context
POST   /bayesian/contexts/{id}/observations     Add observations
GET    /bayesian/contexts/{id}/observations     List observations
GET    /bayesian/contexts/{id}/belief           Get current posterior belief
POST   /bayesian/contexts/{id}/adjust           Adjust PERT estimate using context belief

Architecture

Each feature module (e.g., app/tco/) follows a consistent layered pattern:

  • core.py — Pure calculation functions. No FastAPI or DB dependencies. This is the atomic logic layer.
  • router.py — FastAPI endpoints. Stateless endpoints call core.py directly; stateful endpoints go through crud.py.
  • schemas.py — Pydantic models for request/response validation.
  • models.py — SQLAlchemy ORM models.
  • crud.py — Database operations. Calls core.py to compute values before persisting.

examples/standalone/ contains self-contained library versions of modules (pure Python, optional pandas/matplotlib):

python examples/standalone/tco/tco.py
python examples/standalone/pert/pert.py
python examples/standalone/montecarlo/montecarlo.py
python examples/standalone/evm/evm.py
python examples/standalone/bayesian/bayesian.py

Development

pytest                          # Run all tests
ruff check . && ruff format .   # Lint and format
pyright                         # Type check (app/ only)
opengrep scan --config .opengrep/  # Security audit (SAST)
pre-commit run --all-files      # Run all pre-commit hooks

Full commands, code style, and conventions are in CLAUDE.md.

MCP Server

The decision modules ship as a lean stdio MCP server — runs locally, no account, no data leaves your machine:

uvx pmorun-mcp                                # run the published server
claude mcp add pmo-logic -- uvx pmorun-mcp    # or one line into Claude Code

Four tools over stdio by default: task duration estimation (PERT), schedule risk (Monte Carlo), investment comparison (TCO) and project health (EVM).

Set PMORUN_DB to a writable file path and four more register — an opt-in calibration memory that records what you estimated, then what actually happened, and learns your systematic bias from the pairs. Leave the variable unset and the server writes nothing at all. See mcp_server/README.md for pinning, client configuration, and the storage caveats.

Claude Skills

Same logic, conversational interface. Add a SKILL.md to a Claude Project and start estimating — no deployment needed.

Skill Description
TCO Total Cost of Ownership with NPV adjustment
PERT Three-point estimation with reality adjustments
Monte Carlo Probabilistic schedule simulation (P50/P80/P95)
EVM Earned Value Management for project health tracking

See skills/README.md for details.

Alongside these, skills/operational/ holds a different class — guardrails on how the work is done rather than decision maths, with organisation specifics kept in gitignored overlays. Most of that set (session rituals, staleness sweeps, a ship loop, an anonymisation gate) now lives in agent-ops, since it governs how an agent works rather than anything about this repository; content-cadence remains here.

Docs

License

MIT

About

PMO as a Service - Atomic logic for decision-making. Turning abstract ideas into executable functions.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages