Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .codex/agents/mm-docs-ledger.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = "mm_docs_ledger"
description = "Evidence-focused documentation worker for remediation ledgers, audit deltas, runbooks, and external-action records."
model = "gpt-5.4-mini"
model_reasoning_effort = "medium"
sandbox_mode = "workspace-write"
nickname_candidates = ["Mini Ledger", "Mini Scribe", "Mini Delta"]

developer_instructions = """
Obey the repository AGENTS.md and edit only documentation/planning files explicitly owned in the parent prompt.
Never change production code or tests.
Treat command output and committed diffs as evidence; never mark a finding resolved from intent or an agent self-report.
Preserve finding IDs, rollback instructions, external blockers, and the distinction between implemented and verified.
Do not mutate live databases or external systems and do not commit unless the parent explicitly assigns a worktree and commit.
Return the exact files changed and unresolved evidence gaps.
"""
15 changes: 15 additions & 0 deletions .codex/agents/mm-explorer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = "mm_explorer"
description = "Fast read-only MemoryMaster code mapper for inventories, dependency tracing, and bounded evidence gathering."
model = "gpt-5.4-mini"
model_reasoning_effort = "low"
sandbox_mode = "read-only"
nickname_candidates = ["Mini Map", "Mini Trace", "Mini Scout"]

developer_instructions = """
Work read-only and obey the repository AGENTS.md plus the parent task.
Use MemoryMaster recall before architectural assumptions when its MCP transport is available.
Prefer GitNexus query/context and targeted rg/file reads over broad dumps.
Never propose or make architecture decisions; surface them to the parent with evidence.
Return concise findings with exact files, symbols, risk, and the smallest next action.
Do not edit files, create commits, mutate live databases, or run external-state-changing commands.
"""
16 changes: 16 additions & 0 deletions .codex/agents/mm-fast-worker.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = "mm_fast_worker"
description = "Efficient implementation worker for isolated LOW/MEDIUM-risk fixes with explicit file ownership and acceptance tests."
model = "gpt-5.6-luna"
model_reasoning_effort = "medium"
sandbox_mode = "workspace-write"
nickname_candidates = ["Luna Patch", "Luna Build", "Luna Fix"]

developer_instructions = """
Obey the repository AGENTS.md and the exact owned-file boundary in the parent prompt.
Work only in the assigned isolated worktree and preserve all unrelated changes.
Before modifying an existing symbol, run GitNexus upstream impact analysis.
If risk is HIGH or CRITICAL, stop without editing and return the blast radius to the parent for rerouting.
For a security or integrity fix, first add and run an adversarial test that fails for the intended reason.
Make the smallest complete change, run focused tests and Ruff, and report exact evidence.
Never touch the live MemoryMaster database, push, publish, deploy, rotate credentials, or commit unless explicitly authorized.
"""
15 changes: 15 additions & 0 deletions .codex/agents/mm-security-reviewer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = "mm_security_reviewer"
description = "Read-only high-reasoning reviewer for security boundaries, integrity invariants, bypasses, and missing adversarial coverage."
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
sandbox_mode = "read-only"
nickname_candidates = ["Boundary Review", "Red Review", "Security Gate"]

developer_instructions = """
Review read-only as an independent owner and obey the repository AGENTS.md.
Focus on exploitable bypasses, authorization/scope errors, raw or encoded secret persistence, partial failures, replay/idempotency, and missing tests.
Trace actual callers and sinks with GitNexus and targeted source reads.
Separate merge blockers from follow-ups; cite exact files/symbols and provide a concrete reproduction or invariant for every blocker.
Do not edit, stage, commit, mutate databases, or approve work merely because tests pass.
Return a concise blocker-first report to the parent.
"""
15 changes: 15 additions & 0 deletions .codex/agents/mm-test-runner.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = "mm_test_runner"
description = "Fast verification worker for focused pytest, Ruff, scanners, collection checks, and evidence summaries."
model = "gpt-5.4-mini"
model_reasoning_effort = "medium"
sandbox_mode = "workspace-write"
nickname_candidates = ["Mini Gate", "Mini Probe", "Mini Verify"]

developer_instructions = """
Obey the repository AGENTS.md and run only the verification scope assigned by the parent.
Do not edit source, tests, plans, configuration, or documentation.
Use temporary databases and fake/local services; never mutate the live MemoryMaster database.
Report the exact command, exit code, pass/skip/xfail counts, duration, and concise failure signatures.
Do not infer broad success from a focused test and do not rerun a failing command repeatedly without a new hypothesis.
Leave commits, staging, GitNexus reindexing, and full-suite decisions to the parent.
"""
16 changes: 16 additions & 0 deletions .codex/agents/mm-worker.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = "mm_worker"
description = "General implementation worker for bounded MemoryMaster packages that need stronger multi-step coding and validation."
model = "gpt-5.6-terra"
model_reasoning_effort = "high"
sandbox_mode = "workspace-write"
nickname_candidates = ["Terra Core", "Terra Package", "Terra Worker"]

developer_instructions = """
Obey the repository AGENTS.md and the exact owned-file/worktree boundary in the parent prompt.
Query MemoryMaster before architectural decisions when its MCP transport is available.
Run GitNexus upstream impact before editing every existing symbol and stop for parent warning before HIGH/CRITICAL work not already disclosed.
Add a witnessed failing adversarial test before security or integrity fixes.
Keep changes atomic, immutable, and narrowly scoped; use temporary databases and fake/local external services.
Run focused verification and Ruff, then return changed files, risks, commands, and unresolved blockers.
Never push, publish, deploy, mutate product data, or commit unless explicitly authorized.
"""
5 changes: 5 additions & 0 deletions .codex/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[agents]
max_threads = 2
max_depth = 1
job_max_runtime_seconds = 1800
interrupt_message = true
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Deny the entire build context, then allow only Dockerfile COPY inputs.
**
!Dockerfile
!pyproject.toml
!README.md
!memorymaster/
!memorymaster/**
58 changes: 56 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# Copy to `.env` and edit as needed:
# cp .env.example .env
#
# `.env` is gitignored — never commit real secrets. All values below are
# optional; a fresh install works with zero env vars as long as you either
# `.env` is gitignored — never commit real secrets. Values are optional unless
# the selected deployment profile marks them required. A fresh local install
# works with zero env vars as long as you either
# (a) set GEMINI_API_KEY for the free cloud default, or (b) run Ollama
# locally. Everything else is tuning.
#
Expand All @@ -30,6 +31,49 @@ MEMORYMASTER_WORKSPACE=.
# Default: unset
# MEMORYMASTER_CONFIG_FILE=config.json

# ---------------------------------------------------------------------------
# Deployment authorization
# ---------------------------------------------------------------------------

# MCP authorization is mandatory. local-trusted is for one private stdio
# process controlled by one OS user and uses SQLite only. PostgreSQL application
# runtime is team-only; do not point a local-trusted process at PostgreSQL.
# Values: local-trusted | team
MEMORYMASTER_MCP_AUTH_MODE=local-trusted

# Team mode requires every value below. The database target must be the
# non-owner application DSN, never the migrator DSN. Scopes are an explicit,
# comma-separated allowlist; wildcards are rejected.
# MEMORYMASTER_MCP_PRINCIPAL=agent-id
# MEMORYMASTER_ROLE_AGENT_ID=writer
# MEMORYMASTER_MCP_TENANT_ID=tenant-id
# MEMORYMASTER_MCP_WORKSPACE=/absolute/path/to/workspace
# MEMORYMASTER_MCP_ALLOWED_SCOPES=project:example,global
# MEMORYMASTER_MCP_DB=postgresql://app-role:password@host/database

# Reserved sensitive-read grant. Team mode currently rejects enabled values
# because v0011 intentionally exposes only public or principal-owned private
# rows; keep this at 0 until database policy support is implemented.
# Values: 0 (team mode)
# MEMORYMASTER_MCP_ALLOW_SENSITIVE=0

# Disposable PostgreSQL RLS integration test only. The admin DSN must use a
# dedicated SUPERUSER or BYPASSRLS schema owner; the app DSN must use a distinct
# restricted role. Tests refuse known live DSN variables and require the
# explicit disposable opt-in. Never set these to a product database.
# MEMORYMASTER_TEST_POSTGRES_DSN=postgresql://migrator:password@host/test_database
# MEMORYMASTER_TEST_POSTGRES_APP_DSN=postgresql://app-role:password@host/test_database
# MEMORYMASTER_TEST_POSTGRES_RLS_DISPOSABLE=1

# Required only when rendering docker-compose.postgres.yml. Use a generated
# secret and rotate any environment that used the retired fixed credential.
# MEMORYMASTER_POSTGRES_PASSWORD=

# Required only when rendering docker-compose.yml. Supply immutable image
# references verified for your platform; tags and unqualified names are unsafe.
# QDRANT_IMAGE_DIGEST=sha256:<64-hex-digest>
# OLLAMA_IMAGE_DIGEST=sha256:<64-hex-digest>

# ---------------------------------------------------------------------------
# LLM provider (auto-ingest Stop hook + steward + entity extraction)
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -217,6 +261,16 @@ OLLAMA_URL=http://localhost:11434
# Default: http://localhost:6333 (only honoured when explicitly set)
QDRANT_URL=http://localhost:6333

# Required by the hardened Compose/Helm Qdrant profile. Generate and provision
# this out of band; never commit the value.
# QDRANT_API_KEY=
# QDRANT_TLS_CERT=
# QDRANT_TLS_KEY=
# QDRANT_CA_CERT=

# Optional path to a trusted CA certificate for a TLS-enabled Qdrant endpoint.
# QDRANT_CA_CERT=

# ---------------------------------------------------------------------------
# Lifecycle tuning (volatility: low,medium,high triples)
# ---------------------------------------------------------------------------
Expand Down
83 changes: 82 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -e ".[dev,mcp,security]"
run: pip install -e ".[dev,mcp,security,postgres]"
- name: Run tests
run: pytest tests/ -q --tb=short
env:
Expand Down Expand Up @@ -56,6 +56,19 @@ jobs:
name: perf-smoke-results
path: artifacts/perf/perf_smoke.json

release-truth:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install release-truth dependencies
run: pip install -e ".[dev,mcp,postgres]"
- name: Check generated release truth
run: python scripts/generate_release_truth.py --check

eval:
runs-on: ubuntu-latest
needs: test
Expand All @@ -78,3 +91,71 @@ jobs:
artifacts/eval/eval_results.json
artifacts/eval/eval_report.md
artifacts/eval/eval_checks.csv

deployment-smoke:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: azure/setup-helm@v4
- name: Install MCP smoke dependencies
run: pip install -e ".[mcp]"
- name: Smoke stdio MCP handshake
run: python scripts/smoke_mcp_transport.py --transport stdio
- name: Build deployment image
run: docker build -t memorymaster-ci .
- name: Initialize disposable deployment database
run: |
mkdir -p .ci-data
docker run --rm -v "$PWD/.ci-data:/data" memorymaster-ci \
memorymaster --db /data/memorymaster.db --workspace /data init-db
- name: Smoke dashboard health and readiness
run: |
docker run -d --name memorymaster-dashboard -p 127.0.0.1:8765:8765 \
-e MEMORYMASTER_DASHBOARD_TOKEN_VIEWER=ci-dashboard-token \
-v "$PWD/.ci-data:/data" memorymaster-ci
trap 'docker rm -f memorymaster-dashboard >/dev/null 2>&1 || true' EXIT
for attempt in $(seq 1 30); do
curl --fail --silent http://127.0.0.1:8765/healthz >/dev/null && \
curl --fail --silent http://127.0.0.1:8765/readyz >/dev/null && exit 0
sleep 1
done
docker logs memorymaster-dashboard
exit 1
- name: Smoke authenticated streamable-HTTP MCP handshake
env:
MEMORYMASTER_MCP_HTTP_TOKEN: ci-mcp-http-token
run: |
docker rm -f memorymaster-dashboard >/dev/null 2>&1 || true
docker run -d --name memorymaster-mcp-http -p 127.0.0.1:8765:8765 \
-e MEMORYMASTER_MCP_HTTP_TOKEN \
-e MEMORYMASTER_MCP_AUTH_MODE=local-trusted \
-v "$PWD/.ci-data:/data" memorymaster-ci \
memorymaster-mcp-http --host 0.0.0.0 --port 8765 \
--db /data/memorymaster.db --workspace /data
trap 'docker rm -f memorymaster-mcp-http >/dev/null 2>&1 || true' EXIT
for attempt in $(seq 1 30); do
curl --fail --silent http://127.0.0.1:8765/readyz >/dev/null && break
sleep 1
done
python scripts/smoke_mcp_transport.py --transport http
- name: Render both Helm HTTP profiles
env:
IMAGE_DIGEST: sha256:0000000000000000000000000000000000000000000000000000000000000000
run: |
helm lint helm/memorymaster \
--set image.digest="$IMAGE_DIGEST" \
--set qdrant.apiKeySecret.name=qdrant-ci \
--set service.dashboardTokenSecret.name=dashboard-ci
helm template mm-dashboard helm/memorymaster \
--set image.digest="$IMAGE_DIGEST" \
--set qdrant.apiKeySecret.name=qdrant-ci \
--set service.dashboardTokenSecret.name=dashboard-ci > /tmp/dashboard.yaml
helm template mm-mcp helm/memorymaster \
--set image.digest="$IMAGE_DIGEST" \
--set qdrant.apiKeySecret.name=qdrant-ci \
--set service.profile=mcp-http \
--set service.mcpHttpTokenSecret.name=mcp-http-ci > /tmp/mcp-http.yaml
Loading
Loading