|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Authority |
| 4 | + |
| 5 | +`rasen/specs/` contains the accepted capability specifications and outranks |
| 6 | +change proposals. `rasen/changes/` records design decisions and their rationale; |
| 7 | +do not duplicate that rationale here. |
| 8 | + |
| 9 | +When implementation changes a normative decision, update the affected |
| 10 | +specification in the same change. |
| 11 | + |
| 12 | +## Project boundaries |
| 13 | + |
| 14 | +`omp-codebase-memory` distributes `codebase-memory-mcp` (CBM) as an installable |
| 15 | +OMP extension. It is TypeScript on Bun, has no npm runtime dependencies, and |
| 16 | +commits its bundled entry point at `dist/index.js`. |
| 17 | + |
| 18 | +The following boundaries are fixed: |
| 19 | + |
| 20 | +- Consume CBM release artifacts; contributing changes to |
| 21 | + `DeusData/codebase-memory-mcp` is out of scope. |
| 22 | +- Adopt an existing `codebase-memory-mcp` on `PATH` and never replace it. Put a |
| 23 | + package-managed copy under a package-owned root outside the plugin tree. Never |
| 24 | + write `~/.local/bin` or modify an executable this package did not install. |
| 25 | +- Own exactly the `codebase-memory-mcp` key under `mcpServers` in the active OMP |
| 26 | + agent directory's `mcp.json`. Upsert it idempotently, fail closed on an |
| 27 | + unparseable file or foreign `command`, and remove it only while it still |
| 28 | + matches the package-owned entry. |
| 29 | +- Never create or modify an operator's OMP agent-directory `AGENTS.md` or |
| 30 | + `RULES.md`. |
| 31 | +- Never register a `tool_call` handler. Augment successful output through |
| 32 | + `tool_result`, append rather than replace prior content, and fail open. |
| 33 | +- Never use platform timer globals. Use the handler context's managed timers |
| 34 | + through `src/scheduler.ts`. |
| 35 | +- Never set an account-wide CBM configuration key for the operator. |
| 36 | +- Never duplicate an action already exposed through CBM's MCP tools, including |
| 37 | + indexing. |
| 38 | +- Never hand-edit generated context artifacts; regenerate them from the CBM |
| 39 | + executable. |
| 40 | + |
| 41 | +This package owns only the executable it downloaded and its MCP entry. CBM owns |
| 42 | +the graph, indexing, watcher, cache root, and updates to a system installation. |
| 43 | +Windows and changes to any other operator file are out of scope. |
| 44 | + |
| 45 | +## Repository layout |
| 46 | + |
| 47 | +The working tree contains two independent Git repositories: |
| 48 | + |
| 49 | +- The outer repository tracks code and delivery, including `.github/`, `src/`, |
| 50 | + `test/`, `dist/`, `package.json`, and `.omp-plugin/`. |
| 51 | +- `rasen/` tracks planning artifacts in its own repository and remote. |
| 52 | + |
| 53 | +`rasen/` is ignored by the outer repository. Commit its work with |
| 54 | +`git -C rasen`; never stage planning and implementation in the same repository. |
| 55 | + |
| 56 | +## Git workflow |
| 57 | + |
| 58 | +`main` and release tags are protected by the committed rulesets under |
| 59 | +`.github/rulesets/`. Before implementation, create a short-lived topic branch |
| 60 | +named `<type>/<short-slug>`. |
| 61 | + |
| 62 | +Use Conventional Commits and land changes through pull requests. The ruleset |
| 63 | +permits merge commits only; do not squash. Unresolved review threads block the |
| 64 | +merge. |
| 65 | + |
| 66 | +Treat the committed rulesets as authoritative. Change and reimport those files |
| 67 | +rather than editing protection through the web interface. |
| 68 | + |
| 69 | +## CI and release |
| 70 | + |
| 71 | +Branch protection requires one status check named `ci`. It is the gate job in |
| 72 | +`.github/workflows/ci.yml`, runs under `if: always()`, fails when it aggregates |
| 73 | +no jobs, and accepts only successful dependencies. |
| 74 | + |
| 75 | +- Update the gate's `needs` whenever a required runtime job changes. Do not add |
| 76 | + runtime job names to the ruleset. |
| 77 | +- Keep `install-check` outside the gate because it cannot install a pull |
| 78 | + request's merge ref. |
| 79 | +- Pin every external `uses:` to a full 40-character commit SHA followed by a |
| 80 | + version comment. |
| 81 | +- Default to `permissions: contents: read`, use |
| 82 | + `persist-credentials: false`, and grant `contents: write` only to the release |
| 83 | + publish job. |
| 84 | +- Do not apply `paths` filters to jobs required by the gate. |
| 85 | +- Pin Bun and its matching `@types/bun` version exactly. Install with |
| 86 | + `--frozen-lockfile`. |
| 87 | +- Run checks through package scripts and print toolchain versions with results. |
| 88 | +- Do not add a Node job; Node is not a supported runtime. |
| 89 | + |
| 90 | +`dist/index.js` is committed. CI must build from source and compare the result |
| 91 | +byte-for-byte with that tracked bundle. |
| 92 | + |
| 93 | +A release tag must match `package.json`'s version and both the version and source |
| 94 | +ref in `.omp-plugin/marketplace.json`. Create releases only from verified tags. |
| 95 | + |
| 96 | +## Testing and verification |
| 97 | + |
| 98 | +Add deterministic tests for changed behavior. Cover the package boundaries |
| 99 | +affected by the change: release selection and checksums, archive validation, |
| 100 | +executable resolution, MCP-entry ownership, transport security, scheduler |
| 101 | +behavior, and handler fail-open paths. |
| 102 | + |
| 103 | +`test/unit` must not require a CBM executable or network access. Use recorded |
| 104 | +fixtures under `test/fixtures` and helpers in `test/support`. `test/packaging` |
| 105 | +may build and load the bundle and touch the filesystem. Checks that require a |
| 106 | +real executable or network access belong in a separate job. |
| 107 | + |
| 108 | +Report the commands and revision used for verification. State which relevant |
| 109 | +checks were not run and why; never claim an unexecuted check passed. |
| 110 | + |
| 111 | +## Documentation |
| 112 | + |
| 113 | +`README.md` is operator-facing and must be created or rewritten through the |
| 114 | +`readme-creator` skill and its quality checklist. If that skill is unavailable, |
| 115 | +stop rather than editing the README by hand. |
| 116 | + |
| 117 | +This file is the authority for repository guidance. `AGENTS.md` must remain a |
| 118 | +tracked symbolic link to `CLAUDE.md`; do not create another copy of these rules. |
0 commit comments