Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
152ce07
fix(cypher): prevent stack buffer overflow in string literal lexer
map588 Apr 4, 2026
1d39640
fix(store): add sqlite3_prepare_v2 error checks to prevent NULL stmt …
map588 Apr 5, 2026
fd36045
fix(watcher): add mutex to protect projects hash table from concurren…
map588 Apr 5, 2026
ac8fde6
feat(pipeline): emit CALLS edges for decorator applications
map588 Apr 5, 2026
bac1867
feat(pipeline): emit CALLS edges for decorator applications
map588 Apr 5, 2026
c8661b9
fix(cypher,store): prevent crashes from buffer overflow, OOM, and NUL…
map588 Apr 5, 2026
d6966f9
fix(thread-safety): eliminate races in log mutex, watcher, and index …
map588 Apr 5, 2026
b07fdd3
Update src/pipeline/pass_semantic.c
map588 Apr 5, 2026
c48da5e
Update src/pipeline/pass_parallel.c
map588 Apr 5, 2026
348f890
refactor(memory): add safe_free, safe_str_free, safe_buf_free, safe_g…
map588 Apr 5, 2026
a7333ff
Merge pull request #2 from map588/fix/crash-safety
map588 Apr 6, 2026
f8a9cb7
Merge pull request #3 from map588/fix/thread-safety
map588 Apr 6, 2026
b7779c7
Merge pull request #4 from map588/feat/decorator-references
map588 Apr 6, 2026
b1e9938
Merge branch 'DeusData:main' into main
map588 Apr 6, 2026
9107759
Merge branch 'DeusData:main' into refactor/safe-memory-wrappers
map588 Apr 6, 2026
0f9d8aa
Merge branch 'DeusData:main' into refactor/safe-memory-wrappers
map588 Apr 6, 2026
6c84fa2
Merge branch 'DeusData:main' into main
map588 Apr 6, 2026
9e926c8
Bump actions/download-artifact from 4.3.0 to 8.0.1
dependabot[bot] Apr 6, 2026
d3a555b
Bump msys2/setup-msys2 from 2.30.0 to 2.31.0
dependabot[bot] Apr 6, 2026
3e0cc05
Bump actions/attest-sbom
dependabot[bot] Apr 6, 2026
0885ad2
Bump sigstore/cosign-installer from 3.9.1 to 4.1.1
dependabot[bot] Apr 6, 2026
76a14c5
Merge pull request #5 from map588/dependabot/github_actions/actions/d…
map588 Apr 6, 2026
7f5695c
Merge pull request #6 from map588/dependabot/github_actions/msys2/set…
map588 Apr 6, 2026
8c6ba15
Merge pull request #7 from map588/dependabot/github_actions/actions/a…
map588 Apr 6, 2026
81d2e3c
Merge pull request #8 from map588/dependabot/github_actions/sigstore/…
map588 Apr 6, 2026
b2d3d64
gitignore
map588 Apr 6, 2026
6fdde17
merge complete
map588 Apr 7, 2026
20ed3b0
Merge branch 'DeusData:main' into main
map588 Apr 12, 2026
08259bc
Bump softprops/action-gh-release from 2.6.1 to 3.0.0
dependabot[bot] Apr 13, 2026
9b496d3
Bump actions/attest-sbom from 2.4.0 to 4.1.0
dependabot[bot] Apr 13, 2026
9d3a245
Bump actions/upload-artifact from 7.0.0 to 7.0.1
dependabot[bot] Apr 13, 2026
75c440c
Merge branch 'DeusData:main' into main
map588 Apr 15, 2026
165aecf
Merge pull request #11 from map588/dependabot/github_actions/actions/…
map588 Apr 15, 2026
dd4179a
Merge pull request #10 from map588/dependabot/github_actions/softprop…
map588 Apr 15, 2026
dc44f13
Merge pull request #12 from map588/dependabot/github_actions/actions/…
map588 Apr 15, 2026
add14dd
Merge branch 'DeusData:main' into refactor/safe-memory-wrappers
map588 Apr 15, 2026
3926ddd
Merge origin/main into refactor/safe-memory-wrappers, resolve conflic…
Copilot Apr 15, 2026
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
23 changes: 23 additions & 0 deletions .claude/agents/c-test-writer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
You write C tests for a pure C11 codebase using the custom test framework in `tests/test_framework.h`.

## Conventions

- Use the `TEST(name)` macro to define test functions.
- Use `ASSERT_TRUE`, `ASSERT_FALSE`, `ASSERT_EQ`, `ASSERT_STR_EQ`, `ASSERT_NOT_NULL`, and other assertion macros from the framework.
- Each test must be self-contained with proper setup and teardown (especially freeing arenas and closing store handles).
- Tests compile with ASan + UBSan — no memory leaks, no undefined behavior.

## Patterns to follow

- **Store tests**: See `tests/test_store_nodes.c`, `tests/test_store_edges.c` — open a temporary in-memory store, perform operations, assert results, close store.
- **Pipeline tests**: See `tests/test_pipeline.c` — write source to a temp file, run pipeline passes, query the resulting graph.
- **Extraction tests**: See `tests/test_extraction.c` — parse source with tree-sitter, verify extracted functions/classes/calls.
- **MCP tests**: See `tests/test_mcp.c` — construct JSON-RPC requests, call handlers, verify JSON responses.
- **Foundation tests**: See `tests/test_arena.c`, `tests/test_hash_table.c` — unit test data structures directly.

## Build and run

```bash
scripts/test.sh # Full suite with sanitizers
make -f Makefile.cbm test-foundation # Foundation tests only (fast)
```
20 changes: 20 additions & 0 deletions .claude/agents/security-reviewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
You are a security reviewer for a pure C11 codebase that implements an MCP server.

## What to check

1. **Dangerous calls** — Any new `system()`, `popen()`, `fork()`, `exec*()`, or network calls must be listed in `scripts/security-allowlist.txt`. Flag any that are missing.
2. **Buffer safety** — Look for unbounded `strcpy`, `sprintf`, `strcat`, `gets`. All should use bounded variants (`strncpy`, `snprintf`, arena-allocated buffers).
3. **SQL injection** — All queries in `src/store/store.c` must use parameterized statements (`sqlite3_bind_*`). Flag any string-concatenated SQL.
4. **Prompt injection** — MCP tool handlers in `src/mcp/mcp.c` must validate and sanitize all user-provided input before including it in responses or graph queries.
5. **Memory safety** — Check for use-after-free, double-free, null dereference, and uninitialized reads. The project uses arena allocators (`src/foundation/arena.c`) — verify allocations go through arenas where appropriate.
6. **NOLINT usage** — Any `// NOLINT` suppression must be whitelisted in `src/foundation/recursion_whitelist.h`. Flag unwhitelisted suppressions.
7. **Integer overflow** — Check size calculations, especially in allocation paths and buffer length computations.

## How to verify

Run the 8-layer security audit:
```bash
make -f Makefile.cbm security
```

Review `scripts/security-allowlist.txt` for the current allow-list of dangerous calls.
26 changes: 26 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "if echo \"$CLAUDE_FILE_PATH\" | grep -qE '\\.([ch])$'; then clang-format -i \"$CLAUDE_FILE_PATH\"; fi"
}
]
}
],
"PreToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "if echo \"$CLAUDE_FILE_PATH\" | grep -qE '(vendored/|internal/cbm/grammar_)'; then echo 'BLOCKED: Do not edit vendored or generated grammar files' >&2; exit 1; fi"
}
]
}
]
}
}
39 changes: 39 additions & 0 deletions .claude/skills/add-language/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: add-language
description: Guide through adding or fixing language support (tree-sitter extraction + pipeline passes)
disable-model-invocation: true
---

# Adding Language Support

Language support has two layers. Determine which type of language you're adding:

## Standard Languages (need tree-sitter grammar)

1. **Add grammar** — Vendor the tree-sitter grammar into `internal/cbm/grammar_<lang>.c` using `scripts/vendor-grammar.sh`
2. **Configure node types** — Add language entry in `internal/cbm/lang_specs.c` with AST node types for functions, classes, calls, imports
3. **Write extractor** — Create `internal/cbm/extract_<lang>.c` for language-specific extraction logic
4. **Add enum** — Add `CBM_LANG_<LANG>` to `internal/cbm/cbm.h`
5. **Hook into pipeline** — Update `src/pipeline/pipeline.c` for call resolution, usage tracking
6. **Add tests**:
- `tests/test_extraction.c` — AST extraction regression tests
- `tests/test_pipeline.c` — Integration-level pipeline tests

## Infrastructure Languages (Dockerfile, K8s, etc. — no new grammar needed)

Follow the **infra-pass pattern**:

1. **Detection helper** — Add `cbm_is_<lang>_file()` in `src/pipeline/pass_infrascan.c`
2. **Enum value** — Add `CBM_LANG_<LANG>` in `internal/cbm/cbm.h` and row in `lang_specs.c`
3. **Custom extractor** — Write extractor returning `CBMFileResult*` (reuse YAML grammar if applicable)
4. **Pipeline pass** — Register in `pipeline.c`
5. **Tests** — Follow `TEST(infra_is_dockerfile)` and `TEST(k8s_extract_manifest)` patterns in `tests/test_pipeline.c`

## Verification

```bash
scripts/test.sh # Full test suite
scripts/lint.sh # Must pass all linters
```

Test against a real open-source repo that uses the language.
23 changes: 23 additions & 0 deletions .claude/skills/security-audit/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: security-audit
description: Run the full 8-layer security audit and analyze results
---

Run the 8-layer security audit:

```bash
make -f Makefile.cbm security
```

Analyze the output. The 8 layers are:

1. **Static allow-list audit** — Checks for dangerous calls (`system`, `popen`, `fork`, network) not in `scripts/security-allowlist.txt`
2. **Binary string scan** — Searches compiled binary for suspicious strings
3. **UI audit** — Validates embedded frontend assets
4. **Install audit** — Checks install scripts for unsafe operations
5. **Network egress test** — Verifies no unauthorized network access
6. **MCP robustness (fuzz)** — Sends malformed JSON-RPC to test input handling
7. **Vendored dependency integrity** — Verifies vendored source checksums
8. **Frontend integrity** — Checks graph-ui build artifacts

For each failure, explain what the layer checks, why it failed, and how to fix it. If a new dangerous call is intentional, guide adding it to `scripts/security-allowlist.txt`.
1 change: 1 addition & 0 deletions .claude/worktrees/improvements
Submodule improvements added at 1d3097
6 changes: 3 additions & 3 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
tar -czf codebase-memory-mcp-ui-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
-C build/c codebase-memory-mcp LICENSE install.sh

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
path: "*.tar.gz"
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
cp "$BIN" codebase-memory-mcp.exe
zip codebase-memory-mcp-ui-windows-amd64.zip codebase-memory-mcp.exe LICENSE install.ps1

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: binaries-windows-amd64
path: "*.zip"
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
tar -czf codebase-memory-mcp-ui-linux-${{ matrix.arch }}-portable.tar.gz \
-C build/c codebase-memory-mcp LICENSE install.sh

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: binaries-linux-${{ matrix.arch }}-portable
path: "*.tar.gz"
8 changes: 4 additions & 4 deletions .github/workflows/_soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: scripts/soak-test.sh build/c/codebase-memory-mcp ${{ inputs.duration_minutes }}
- name: Upload metrics
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: soak-quick-${{ matrix.goos }}-${{ matrix.goarch }}
path: soak-results/
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
scripts/soak-test.sh "$BIN" ${{ inputs.duration_minutes }}
- name: Upload metrics
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: soak-quick-windows-amd64
path: soak-results/
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
run: scripts/soak-test.sh build/c/codebase-memory-mcp 15
- name: Upload metrics
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: soak-asan-${{ matrix.goos }}-${{ matrix.goarch }}
path: soak-results/
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
scripts/soak-test.sh "$BIN" 15
- name: Upload metrics
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: soak-asan-windows-amd64
path: soak-results/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
"

- name: Attest SBOM
uses: actions/attest-sbom@bd218ad0dbcb3e146bd073d1d9c6d78e08aa8a0b # v2
uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0
with:
subject-path: '*.tar.gz'
sbom-path: 'sbom.json'
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
git tag -f "$VERSION"
git push origin "$VERSION" --force

- uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
- uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v2
with:
tag_name: ${{ inputs.version }}
draft: true
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@ Thumbs.db

# MCP config (user-local, generated by install command)
.mcp.json

./.claude/settings.json
./.claude/agents/*
./.claude/skills/*
./.claude/worktrees/*
# MCP Registry auth tokens
.mcpregistry_*

# Local project memory (Claude Code auto-memory)
memory/
reference/
.remember/

CLAUDE.md
docs/superpowers/

# Build artifacts
build/
Expand Down
Loading