Skip to content

Latest commit

 

History

History
186 lines (144 loc) · 15.3 KB

project-structure.md

File metadata and controls

186 lines (144 loc) · 15.3 KB

Project Structure

Workspace == Repo

CoderMind installs alongside your project code: the directory you run cmind init in, also called the workspace root, is the project repository root. There is no separate repo/ subdirectory. This means:

  • cmind init my-project --ai claude creates my-project/ for your source code (src/, tests/, docs/) alongside CoderMind's in-workspace configuration files (.cmind/config.toml, .claude/, .github/, .vscode/, depending on the selected agent). Init installs integrations, not your application code.
  • cmind init --here --ai claude inside an existing git repository adds CoderMind on top of the existing code without moving the repository; use --ai copilot for Copilot.
  • A single .git repository tracks user-owned code and any CoderMind files the user chooses to commit. Runtime data, logs, and the inner-git snapshot repo all live outside the workspace under ~/.cmind/workspaces/<workspace-id>/, so generated artefacts don't pollute your repo or accidentally get committed. Only a small set of user-facing files (.cmind/config.toml, .cmind/reports/*.html) stay inside the workspace.
  • The tracked workspace marker contains only a provider recommendation, not executable authority. User-local execution selection lives separately under ~/.cmind/execution/<full-sha256>/selection.json; it is neither repository configuration nor RPG metadata.

After cmind init

Running cmind init installs templates from the installed CLI's packaged bundle. Init requires an explicit --ai choice or an interactive selection; non-TTY init requires --ai. The layout below combines both supported integrations for reference; only the selected integration is installed. Source directories and reports appear as you add code or run pipeline stages.

my-project/
├── src/                                # Your application code (not generated by init)
├── tests/                              # Your tests
├── docs/                               # Optional requirement docs for /cmind.feature_spec
│   ├── project_charter.md              # Auto-detected when no description is provided
│   └── ...
├── .claude/                            # Claude Code configuration when --ai claude
│   ├── commands/                       # /cmind.* command definitions
│   │   ├── cmind.feature_construct.md
│   │   ├── cmind.feature_spec.md
│   │   ├── cmind.feature_build.md
│   │   ├── cmind.feature_refactor.md
│   │   ├── cmind.feature_edit.md
│   │   ├── cmind.plan.md
│   │   ├── cmind.build_skeleton.md
│   │   ├── cmind.build_data_flow.md
│   │   ├── cmind.design_base_classes.md
│   │   ├── cmind.design_interfaces.md
│   │   ├── cmind.plan_tasks.md
│   │   ├── cmind.code_gen.md
│   │   ├── cmind.rpg_edit.md
│   │   ├── cmind.encode.md
│   │   └── cmind.update_rpg.md
│   └── settings.json                   # SessionStart status + read-only rpg-tools allow rule
├── .mcp.json                           # Claude MCP registration (unless --no-mcp)
├── .github/                            # Copilot configuration when --ai copilot
│   ├── agents/                         # cmind.* agent definitions
│   └── prompts/                        # companion prompts
├── .vscode/                            # Copilot/VS Code configuration when applicable
│   ├── mcp.json                        # MCP server registration
│   └── tasks.json                      # folderOpen status task; no AI update
├── .gitignore                          # Ignores generated integrations and obsolete runtime copies
├── .cmind/
│   ├── config.toml                     # Tracked discovery marker + provider hint; no execution consent
│   └── reports/                        # User-facing HTML reports (rpg.html, review HTML, ...)
└── .git/                               # Project Git metadata, not the CoderMind snapshot repo
    └── hooks/                          # CoderMind Git hooks OFF by default
        ├── post-commit                 # Only with --git-hooks: foreground deterministic sync
        └── post-merge                  # Only with --git-hooks: foreground deterministic sync

The Git layout shown is for a normal checkout; .git may instead be a worktree/submodule pointer, and core.hooksPath may select another hooks directory. Init/update remove recognized CoderMind Git hook blocks by default, preserving unrelated content. Repeat --git-hooks on each invocation to retain sync-only hooks. They never launch AI or background workers; use /cmind.update_rpg explicitly for an AI-driven update.

Out-of-workspace runtime and execution stores

The RPG store is keyed by a path-derived slug (the workspace's absolute path, lowercased, with non-alphanumeric runs collapsed to -). Execution selection uses a separate full hash:

~/
├── .cmind/
│   ├── execution/<full-sha256>/
│   │   └── selection.json              # User-local provider selection + canonical workspace identity
│   └── workspaces/<workspace-id>/
│       ├── .meta.toml                  # Workspace back-pointer, provisioning channel, versions/timestamps
│       ├── .git/                       # Private snapshot repo, when initialized
│       ├── .gitignore                  # Excludes logs/copilot/; other logs may be snapshotted
│       ├── data/                       # RPG and pipeline artifacts
│       │   └── trajectory/             # Execution traces
│       └── logs/                       # Per-stage logs, hooks.log, provider session traces
└── .copilot/
    └── mcp-config.json                 # Copilot CLI registration unless skipped

selection.json records exactly schema_version, workspace, and ai_provider. Its directory uses the full SHA-256 of the canonical workspace identity, not the RPG slug. A trusted explicit constructor choice or trusted process environment can supply execution authority instead. Repository hints, .meta.toml, detected agent folders, and copied runtime state cannot authorize AI calls. Do not migrate consent by copying or editing records: a clone, move, or new user requires an explicit selection. See configuration.md.

The provisioning channel now lives in home-side .meta.toml, not an in-repository .cmind/.source. The snapshot repository lives in the RPG home store, not <workspace>/.cmind/.git. --no-cmind-git skips snapshot initialization for this init, or backfilling a missing snapshot repo during update; it does not delete or disable an existing snapshot repo. This is separate from project --no-git and Git sync hooks. Copilot's home-side MCP registration can be skipped with --no-copilot-cli-mcp; --no-mcp skips MCP registration altogether, without removing existing permissions or registrations.

Reports (rpg.html, review HTML, …) stay inside the workspace at <workspace>/.cmind/reports/ because they are small, user-facing artefacts that benefit from sitting next to the code (and may be committed).

<workspace-id> is normally the slug itself (e.g. home-hys-projects-myrepo); paths whose slug exceeds 200 characters are truncated and given a 6-char base36 SHA-256 suffix so the directory name fits comfortably under POSIX NAME_MAX (255). Same shape as Claude Code's ~/.claude/projects/. Moving or renaming the workspace yields a different id, so each clone has independent state. Run cmind version from inside the workspace to see the resolved paths (the Data, Logs, and Inner git lines). For backward compatibility, workspaces created before 0.1.4 (which used a 12-hex-char SHA-256 hash directory) continue to resolve correctly.

Pipeline scripts (formerly materialised into .cmind/scripts/) now live inside the installed cmind-cli wheel under cmind_cli/core_pack/scripts/ and are invoked via the global cmind script <name> command. They are no longer copied into each workspace, so cmind init produces a much smaller footprint and a single source of truth per CLI install.

Old ignored .cmind/scripts/ copies are obsolete, not the source used by cmind script; do not run or refresh them as a migration step. Generated agent command folders are also ignored by default and can be materialized through an explicitly requested init/update. The tracked provider hint is intentionally retained. Bundled template provisioning itself needs no download, but optional encoding and update's default self-upgrade can use the network; this is not a whole-workflow offline guarantee.

The agent configuration directory varies by the selected AI assistant and release package. For the verified CLI path, --ai claude installs .claude/commands/, while --ai copilot installs .github/agents/, .github/prompts/, and .vscode/mcp.json.

Command definitions are installed into the AI-agent-specific folder. Normal users should not need to inspect ~/.cmind/workspaces/<workspace-id>/data/ directly—run cmind version from the workspace to see all relevant paths.

Quick reference: where does each file live?

Artefact Location
Your source code <workspace>/
Tracked workspace marker / provider hint (not authority) <workspace>/.cmind/config.toml
User-local execution selection ~/.cmind/execution/<full-sha256>/selection.json
RPG / provisioning metadata (not authority) ~/.cmind/workspaces/<workspace-id>/.meta.toml
User-facing HTML reports (rpg.html, …) <workspace>/.cmind/reports/
Agent command definitions <workspace>/.claude/ or <workspace>/.github/
Workspace MCP / status config <workspace>/.mcp.json, .claude/settings.json, or .vscode/, depending on agent
Copilot CLI MCP registration ~/.copilot/mcp-config.json
Opt-in Git sync hooks (post-commit, post-merge) Active Git hooks directory, normally <workspace>/.git/hooks/; honors core.hooksPath
Generated data (rpg.json, dep_graph.json, …) ~/.cmind/workspaces/<workspace-id>/data/
Per-stage logs ~/.cmind/workspaces/<workspace-id>/logs/
Inner-git snapshot repo ~/.cmind/workspaces/<workspace-id>/.git/
Pipeline scripts (read-only) inside the installed cmind-cli wheel

To see the resolved paths for the current workspace, run cmind version from anywhere inside it.

Generated Data Files

As you run /cmind.* commands, ~/.cmind/workspaces/<workspace-id>/data/ is progressively populated (paths below are shown relative to that directory):

Generated file Command Description
feature_spec/ feature_spec Evidence and feature specification documents
feature_spec.json feature_spec Structured feature specification
feature_build.json feature_build Expanded feature tree
feature_tree.json feature_refactor / feature_edit Component architecture
skeleton.json build_skeleton File skeleton
skeleton_summary.txt build_skeleton Human-readable skeleton summary
rpg.json build_skeleton / encode, then updated by later commands Repository Planning Graph
dep_graph.json encode / update_rpg / rpg_edit Code dependency graph used for incremental sync and edits
data_flow.json build_data_flow Inter-component data flow DAG
data_flow_viz.html build_data_flow Data flow visualization
base_classes.json design_base_classes Shared base class definitions
interfaces.json design_interfaces Function/class interface definitions
tasks.json plan_tasks Implementation task batches
code_gen_state.jsonl code_gen Code generation progress state, append-only JSONL
rpg_edit_impact.json rpg_edit Impact analysis for a surgical edit
rpg_edit_plan.json rpg_edit Confirmed surgical edit plan
rpg_edit_code_result.json rpg_edit Code application result for a surgical edit
trajectory/ All scripts Execution trajectory logs

rpg.json — The Repository Planning Graph

rpg.json is the central graph artifact used by the forward pipeline, reverse encoder, MCP tools, opt-in deterministic sync hooks, explicit AI updates, and /cmind.rpg_edit.

It can be created in either direction:

  1. Forward pipeline: /cmind.build_skeleton creates rpg.json from feature_tree.json.
  2. Reverse encoder: /cmind.encode creates rpg.json from an existing codebase.

Later commands enrich or maintain the same file:

  1. build_data_flow — adds data-flow edges between components.
  2. design_base_classes — adds base-class relationship edges.
  3. design_interfaces — adds fine-grained dependency edges such as inheritance, invocation, and references.
  4. code_gen — updates implementation status as code is generated.
  5. update_rpg — explicitly runs an AI-driven incremental update of the current working tree against HEAD~1; requires an existing RPG and available history, independently of Git hooks.
  6. rpg_edit — applies targeted feature graph edits together with code and dependency graph changes.

dep_graph.json — Code Dependency Graph

dep_graph.json stores the code-level dependency graph used by the encoder, incremental update path, and surgical edit path. It is maintained alongside rpg.json so CoderMind can keep feature-level structure and code-level dependencies aligned.

Typical producers and updaters:

  • /cmind.encode creates the initial dependency graph when encoding an existing codebase.
  • Opt-in Git hooks provide deterministic sync after commits/merges; /cmind.update_rpg explicitly refreshes the graphs with AI after code changes.
  • /cmind.rpg_edit refreshes it after applying targeted code edits.

Runtime Logs and Reports

Runtime logs are written under ~/.cmind/workspaces/<workspace-id>/logs/, for example:

  • ~/.cmind/workspaces/<workspace-id>/logs/encode.log
  • ~/.cmind/workspaces/<workspace-id>/logs/update_rpg.log
  • ~/.cmind/workspaces/<workspace-id>/logs/feature_build.log
  • ~/.cmind/workspaces/<workspace-id>/logs/build_data_flow.log

Execution traces are written under ~/.cmind/workspaces/<workspace-id>/data/trajectory/. Review or diagnostic artifacts may be written under <workspace>/.cmind/reports/ when a command generates them.

To discover the home-side paths (data / logs / inner-git) for the current workspace, run cmind version from anywhere inside it—the relevant lines are labelled Workspace, Data, Logs, and Inner git.

Repository CI Configuration

In the CoderMind source repository, remote actions in GitHub workflows are pinned to full-length commit SHAs with version comments, rather than mutable tags. When updating an action manually, verify the upstream release commit and update both the SHA and its version comment. Local reusable workflow references stay relative to the repository.

Dependabot checks GitHub Actions weekly, groups their updates, and applies a seven-day cooldown before proposing newly released versions. The pins and cooldown reduce supply-chain risk; they do not replace reviewing action updates.