Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
**
!CodeMesh.sln
!Directory.Build.props
!VERSION
!NuGet.config
!src/
!src/CodeMesh.Domain/
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/baseline-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ jobs:
run: |
git diff --check "$CHECK_RANGE"
npx --yes markdownlint-cli2@0.23.1 "**/*.md"
python tools/check_version.py
python tools/check_markdown_links.py
python tools/check_publication_safety.py
python tools/check_github_workflows.py .github/workflows/baseline-standards.yml
if [[ "$EVENT_NAME" == "pull_request" ]]; then
python tools/check_conventional_commit.py --message "$PULL_REQUEST_TITLE"
else
Expand Down
50 changes: 39 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ Before planning larger CodeMesh work, review these repository notes:

- `docs/README.md` is the documentation hub and authority map.
- `docs/guides/agent-quickstart.md` routes AI agents through the repository.
- `COMMANDS.md` is the canonical repository command index, while
`docs/evaluation/testing.md` defines risk-based check selection.
- `docs/current/project-status.md` records current implementation and reviewed evidence.
- `docs/planning/next-steps.md` is the execution-order authority for future product work.
- `docs/current/architecture.md`, `docs/current/agent-access-contracts.md`, and source/tests
define current component and interface behavior.
- `docs/evaluation/testing.md`, `docs/current/security-and-redaction.md`, and
`docs/engineering/standards.md` define verification, safety, and completion
discipline.
- `docs/engineering/methodology.md` defines evidence, authority, and
reusable-control admission boundaries.

Treat `docs/planning/next-steps.md`,
`docs/planning/agent-integration-contract.md`,
Expand All @@ -33,37 +37,61 @@ Treat `docs/planning/next-steps.md`,
## Agent Defaults

- Inspect `git status --short --branch` before editing and preserve unrelated
work. Stage only task-related files or hunks when a commit is requested.
work. Stage only task-related files or hunks for each commit.
- Prefer the smallest coherent change and existing repository patterns. Keep
implemented behavior, passing tests, reviewed evidence, release, deployment,
and production authority distinct.
- Do not print `.env` contents, credentials, tokens, private keys, certificates, or local secret values.
- For implementation changes, run `dotnet run --project tests/CodeMesh.Tests` from the repo root unless clearly irrelevant.
- For Python Agent Access changes, also run `uv run pytest` from `agent-access`.
- Use the supported invocations in `COMMANDS.md` and the risk map in
`docs/evaluation/testing.md`; do not improvise weaker substitutes for an
unavailable required check.
- For changes crossing .NET/Python contracts, serialization, lifecycle, or
integration boundaries, run both suites.
- Use `.\scripts\e2e-smoke.ps1` when changes affect live store wiring, Docker services, repository lifecycle, cleanup, or Agent Access integration.
- Documentation-only changes usually do not require application tests. Run
`npx --yes markdownlint-cli2@0.23.1 "**/*.md"`,
`python tools/check_markdown_links.py`, and `git diff --check`.
- Use Conventional Commits for requested commits. Validate a proposed range
with `python tools/check_conventional_commit.py --range BASE..HEAD` when
relevant; do not install or alter Git hooks implicitly.
- Use the end-to-end smoke path when changes affect live store wiring, Docker
services, repository lifecycle, cleanup, or Agent Access integration.
- Documentation-only changes usually do not require application tests; run the
repository standards checks listed in `COMMANDS.md`.
- Use Conventional Commits. Validate a proposed range
with the checker listed in `COMMANDS.md` when relevant; do not install or
alter Git hooks implicitly.
- Record consequential implemented architecture decisions under
`docs/decisions/`; do not use decision records to present planning as current
behavior.
- Keep current status in `docs/current/project-status.md`, future execution order in
`docs/planning/next-steps.md`, and detailed proposals in their dedicated planning
documents.

## Development Feedback Sessions

- Development-feedback MCP profiles are available only through the explicit,
reviewed session procedure in `docs/guides/mcp-setup.md`. Do not create or
activate a session unless the user asks for that operational action.
- When acting as the CodeMesh maintainer in an active session, start with
`codemesh_list_feedback`, retrieve the selected exact id with
`codemesh_get_feedback`, and reproduce the report read-only.
- Use `codemesh_prepare_feedback_resolution` to validate and hash the smallest
proposed change. Do not edit source until a human explicitly approves the
exact feedback ids and returned plan hash. An agent-supplied confirmation is
not human approval.
- After approval, preserve normal completion discipline. A passing client
recheck must append a new packet that names the original failure in
`supersedes_feedback_ids`; do not edit or delete either packet.

## Completion And Authority

- Once a unit of work has been completed, commit the relevant files. Work is
complete when:
- Implementation is complete.
- Tests have been updated, and changes verified through testing.
- Documentation has been updated.
- Update canonical documentation when behavior, commands, contracts, setup,
architecture, or verified status changes.
- Use the narrowest truthful evidence state defined in
`docs/engineering/methodology.md`; one state never implies a later state.
- Report passed, failed, skipped, and unavailable checks separately.
- Review the final diff for accidental or unrelated changes and report the
final worktree state.
- A completed implementation does not authorize a commit, tag, release,
- A completed unit of work and its commit do not authorize a tag, release,
publication, deployment, production mutation, external spend, or other live
side effect unless the user explicitly requests it and the repository's
relevant gates are satisfied.
Expand Down
252 changes: 252 additions & 0 deletions COMMANDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
# CodeMesh repository commands

This is the canonical index for supported contributor and coding-agent
commands. Use [Testing](docs/evaluation/testing.md) for risk-based check
selection, end-to-end variants, evaluation gates, and result interpretation.
Use the linked operating guides for ordered product or evaluation procedures.

Run commands from the repository root unless a section says otherwise. Run
.NET commands serially because projects share intermediate output directories.

## Deterministic verification

### .NET

```powershell
dotnet restore CodeMesh.sln --locked-mode
dotnet build CodeMesh.sln --no-restore
dotnet run --project tests/CodeMesh.Tests --no-restore
dotnet format CodeMesh.sln --verify-no-changes --no-restore
```

### Python Agent Access

Run from `agent-access`:

```powershell
uv sync --locked
uv run --no-sync pytest
uv run --no-sync ruff check . ../tools
uv run --no-sync ruff format --check . ../tools
uv run --no-sync python -m codemesh_agent_access eval
```

The last command is the deterministic in-process MCP fixture suite. It uses no
Docker service or model provider. Run both .NET and Python checks after changes
to shared contracts, serialization, lifecycle, integration, or end-to-end
behavior. A focused change may use only its affected surface when the handoff
states why the other suite was not required.

For the development-feedback session boundary and its real stdio rehearsal,
run from `agent-access`:

```powershell
uv run --no-sync pytest tests/test_feedback.py tests/test_feedback_session.py tests/test_development_feedback.py tests/test_development_feedback_integration.py tests/test_installer_probe.py tests/test_mcp_contract.py
```

The integration test uses disposable Git state, exact local MCP stdio launches,
and `CODEMESH_MODEL_PROVIDER=none`. It records only bounded fixture packets and
does not edit CodeMesh. Use [MCP Setup](docs/guides/mcp-setup.md#agent-feedback)
for the human-reviewed session, installation, approval, recheck, and revocation
procedure.

### Repository standards

```powershell
npx --yes markdownlint-cli2@0.23.1 "**/*.md"
python tools/check_version.py
python tools/check_markdown_links.py
python tools/check_publication_safety.py
python tools/check_github_workflows.py .github/workflows/baseline-standards.yml
git diff --check
```

Validate a proposed commit range when relevant:

```powershell
python tools/check_conventional_commit.py --range BASE..HEAD
```

The documentation, publication-safety, and workflow-policy checks are local
and read-only. The GitHub workflow definition and a local workflow-policy pass
are not evidence that hosted GitHub Actions passed.

## End-to-end verification

Use the PowerShell smoke path when changes affect live store wiring, Docker
services, repository lifecycle, cleanup, REST endpoints, or Agent Access
integration:

```powershell
.\scripts\e2e-smoke.ps1
```

The script uses disposable fixture state, but it starts local containers and
services. See [Testing](docs/evaluation/testing.md#end-to-end-smoke) for its
selection rules and variants.

For unpublished security corrections and candidate review, the
[local CodeQL procedure](docs/current/security-and-redaction.md#local-codeql-verification)
pins query packs, separates threat models, and forces evaluation after a model
change. Local scanning does not authorize SARIF upload or alert dismissal.

## Local product health

```powershell
dotnet run --project src/CodeMesh.Cli -- doctor
dotnet run --project src/CodeMesh.Cli -- status
docker compose ps
Invoke-RestMethod http://127.0.0.1:8088/health
docker compose logs --tail 100 agent-access csharp-parser
```

These commands inspect the configured local environment. They do not establish
release, deployment, external acceptance, or production fitness.

## Operational and evaluation procedures

Use the controlling guide instead of treating isolated commands as authority:

- [MCP Setup](docs/guides/mcp-setup.md) for local services, ingestion, refresh,
health, and MCP configuration;
- [Self-Analysis](docs/guides/self-analysis.md) for indexing and querying this
repository; and
- [MCP Effectiveness Evaluation](docs/evaluation/mcp-effectiveness.md) for live,
agent, comparison, and model-backed evaluation.

For provider-free context-package latency attribution, add
`--capture-context-package-timings` to `eval live`; the evaluation guide defines
the sanitized sideband and report contract.

Live services, provider-backed runs, model spend, raw-trace retention, external
accounts, publication, release, deployment, and production mutation require
their own authority and evidence gates. The presence of a command in a guide
does not grant that authority.

Agent campaigns additionally require `--max-reported-tokens` and a selected
runner that declares compatible hard-cap enforcement. The default
`--runner codex` reports usage only after completion and therefore fails
provider-free capability preflight before any model call. Select
`--runner capped-codex` explicitly for the loopback Responses proxy after the
evaluation guide's remaining identity, retrieval, safety, authority, and spend
gates pass; a repetition limit or post-run audit does not satisfy this gate.

### Summary-model qualification

The qualification runner uses the production summary prompt and parser. Start
from the checked-in synthetic suite and profile examples, then replace the
profile placeholders and use a separately reviewed, frozen corpus for real
qualification:

```powershell
dotnet run --project src/CodeMesh.Cli -- summaries qualify run `
--suite docs/evaluation/assets/summary-qualification-suite.example.json `
--profile <profile.json> `
--private-output <private-archive.json> `
--review-output <blinded-review-packet.json> `
--summary-provider <ollama|lmstudio|openai> `
--summary-model <exact-model-id>

dotnet run --project src/CodeMesh.Cli -- summaries qualify bind-retrieval `
--archive <private-archive.json> `
--baseline-live <no-summary-live-report.json> `
--candidate-live <candidate-summary-live-report.json> `
--assessment <reviewed-retrieval-assessment.json> `
--ranking-identity <exact-shared-ranking-configuration> `
--confirm-isolated-indexes `
--output <retrieval-evidence.json>

dotnet run --project src/CodeMesh.Cli -- summaries qualify compile `
--suite <frozen-suite.json> `
--archive <private-archive.json> `
--review <reviewer-a.json> `
--review <reviewer-b.json> `
--retrieval <retrieval-evidence.json> `
--deployment <resource-or-cost-evidence.json> `
--output <sanitized-report.json>

dotnet run --project src/CodeMesh.Cli -- summaries qualify compare `
--candidate <candidate-report.json> `
--reference <reference-report.json>
```

`run` refuses dirty CodeMesh checkouts and mismatched suite, profile, provider,
or model identities. Online runs additionally require
`--authorize-online-source`; that flag records the operator's explicit action
but does not replace source-governance, account, or spend approval. Output
paths use create-new semantics. Private archives and review packets contain
source or generated text and must remain in restricted evidence storage.
`compile` requires two complete blinded reviews bound to the same non-empty
disagreement-resolution record hash, a reviewed query-level retrieval
assessment bound to comparable live reports, and complete resource or online
cost evidence bound to the deployment profile. Missing or incompatible
evidence produces `invalid-run`, never a qualified result. The example suite is
a smoke fixture, not a sufficient qualification corpus. Example schemas for
review, retrieval-assessment, and deployment evidence are under
`docs/evaluation/assets/`.

### Local backup and recovery

Use [Backup and Recovery](docs/guides/backup-and-recovery.md) for the reviewed
sequence, ownership checks, stopped-set copy, new-volume restoration, image
identity verification, and complete data/retrieval comparison. The commands
apply only to the explicitly selected environment; the retained example uses
disposable stores and does not authorize changes to existing user data.

## External advisory checks

Before publication or dependency changes, and only when network access is
appropriate, run:

```powershell
dotnet list CodeMesh.sln package --vulnerable --include-transitive
Set-Location agent-access
uv audit --locked
```

These results are time-dependent because they query external advisory data.

## Application version

```powershell
dotnet run --project src/CodeMesh.Cli -- --version
```

From `agent-access`:

```powershell
uv run --no-sync python -m codemesh_agent_access --version
```

`VERSION` is the canonical source version. .NET builds consume it; Python
package metadata and exports are synchronized by `tools/check_version.py`.
The .NET informational version may include a build commit suffix. Version
output is available without opening stores or loading repository `.env` files.
It identifies software, not a published release or an accepted deployment.
See [Release Preparation](docs/engineering/release-preparation.md).

### Local package verification

Use new disposable output directories and record their exact paths. From the
repository root:

```powershell
dotnet publish src/CodeMesh.Cli/CodeMesh.Cli.csproj --no-restore -c Release -p:PublishDir=<new-dotnet-output>/
dotnet <new-dotnet-output>/CodeMesh.Cli.dll --version
```

From `agent-access`, build the Python artifacts and install the wheel into a
fresh environment with the locked runtime dependency set:

```powershell
uv build --out-dir <new-python-output>
uv export --locked --no-dev --no-emit-project --format requirements-txt --output-file <requirements-file>
uv venv <new-package-environment>
uv pip sync --python <environment-python> --require-hashes <requirements-file>
uv pip install --python <environment-python> --no-deps <built-wheel>
```

Run the installed `codemesh-agent-access --version` outside the source checkout,
and inspect REST OpenAPI and the normal MCP manifest from that environment.
Record SHA-256 checksums for the artifacts and the source SHA. These local
commands do not publish packages or establish release acceptance.
Loading