# MeshKore Standard §8 — editor boot block (Cursor).
# Source: https://meshkore.com/reference/cluster/editor-rules/.cursorrules
# Kept LOCAL at repo root, gitignored by default. Pull the latest from
# the URL above when the standard bumps.

# MeshKore Standard

This repo applies the MeshKore Standard. The single source of truth is
https://meshkore.com/standard — read it at the start of every session
and apply it throughout.

What this means in practice:
- The .meshkore/ folder follows the canonical layout (standard §2).
- Tasks live at .meshkore/modules/<module>/tasks/<ID>-<slug>.md and
  carry the canonical frontmatter (standard §4). Done tasks move to
  .meshkore/modules/<module>/log/<YYYY-MM>/.
- Docs live at .meshkore/docs/<category>/<file>.md with the canonical
  frontmatter (standard §5) and obey governance rules R1-R6.
- Session logs (prose) go to .meshkore/log/<YYYY-MM-DD>.md — no
  frontmatter required, append-only.
- The event timeline at .meshkore/timeline/<YYYY-MM-DD>.jsonl is
  machine-only — never edit by hand.
- The public file is .meshkore/public/cluster.yaml (only thing
  committed to git).

## Hard rules — never

- Never commit anything under .meshkore/ outside public/.
- Never edit generated files (state.json, state.js, directory.json).
- Never push to origin without the operator explicitly asking.
- Never create a new top-level module or doc category without first
  declaring the module in cluster.yaml. Use category: general if
  unsure and ask.
- Never duplicate normative content from the standard into a local
  doc. Link to https://meshkore.com/standard.

## Refresh cadence

- Fetch https://meshkore.com/standard/version once per session (or
  every 24 h, whichever comes first). A single integer. If higher than
  .meshkore/STANDARD_VERSION, read the relevant section(s) in
  https://meshkore.com/standard/CHANGELOG.md and apply.
- For layer-specific engineering standards (audit, stack, deploy,
  testing, monitoring, tools), the catalog is at
  https://meshkore.com/reference/standards/ with a machine-readable
  index at https://meshkore.com/reference/manifest.json.

## With the Python daemon

If the L3 daemon is running locally (curl localhost:5570/health
returns OK — or any free port in 5570-5589), prefer its API for
real-time updates:
- POST localhost:5570/chat/send
- POST localhost:5570/tasks/<id>/transition
- WebSocket localhost:5570/events

If no daemon is running, start one from the repo root:
    python3 .meshkore/scripts/daemon.py
(curl daemon.py from
 https://meshkore.com/reference/cluster/scripts/daemon.py if absent.)
Otherwise edit files directly and re-run
python3 .meshkore/scripts/roadmap-build.py to rebuild state.json.

## Versioning

- Conventional Commits 1.0.0: <type>(<scope>): <subject> [<task-id>].
  Types: feat fix docs style refactor perf test chore build ci revert.
- When the daemon is running, versions are issued by it (never invented
  locally): POST localhost:5570/version/next with { bump, task_id }.
- One concern per commit. Don't create branches unless asked.

## Protocols — "apply P<N>"

.meshkore/protocols/P<N>-*.md files are reusable runbooks. When the
operator says "apply protocol P<N>", open the file, check
Preconditions, run Steps in order, append a run-log entry under
.meshkore/protocols/log/<YYYY-MM>/. Schema: standard §14. Daemon:
GET /protocols · GET /protocols/<id> · GET /protocols/<id>/runs.
P1 = bump standard version, P2 = deploy project.

## Deployment links registry

Every commit that changes where a module runs, where it deploys, what
branch it lives on, or what version it carries MUST also update
.meshkore/public/links.yaml in the same commit (standard §13). Daemon
endpoints: GET /links · GET /links/<id> · POST /links/<id>.

## When unsure

Open https://meshkore.com/standard and re-read the relevant section.
If a local file under .meshkore/docs/ contradicts the standard, the
standard wins for universal pieces — surface the diff to the operator
and ask before silently overriding.
