-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
This page is the developer onboarding for working on graft itself, not on memories stored inside it.
src/ C11 sources, one subdir per concern (insert/, retrieve/, ...)
include/ public-style headers (ops.h, types.h, config.h, http.h)
tests/ C-based test executables, one per file (test_*.c)
docs/ per-area markdown docs (the wiki summarizes these)
viewer/ Vue 3 + three.js SPA
integrations/ adapters for Claude Code, MCP, etc.
third_party/ submodules: BLAKE3, llama.cpp, mpack, sqlite-vec
Formula/ Homebrew formula
bucket/ Scoop manifest
.github/workflows/ CI: homebrew-bottle, scoop-bucket, release
git clone --recurse-submodules https://github.com/AEndrix03/Graft.git
cd Graft
# llama.cpp first (shared libs are needed by graft)
cmake -S third_party/llama.cpp -B third_party/llama.cpp/build \
-DBUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF \
-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build third_party/llama.cpp/build --parallel 2
# graft itself
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGRAFT_BUILD_TESTS=ON
cmake --build build --parallelcd build
ctest --output-on-failureTests live in tests/test_*.c. Each is a stand-alone executable that links graft_core. Add new tests by dropping a test_<name>.c in tests/ — the cmake glob picks it up automatically.
Conventional Commits, enforced by .git/hooks/commit-msg (the same hook used in the homebrew formula sanity check).
<type>(<scope>): <description>
<type> ∈ feat | fix | chore | docs | style | refactor | test | perf | build | ci. Subject ≤ 70 chars. No body. No Co-Authored-By: trailer.
Examples:
feat(insert): add atomic supersession via --supersedes
fix(verify): handle empty title in trigram path
ci(brew): cap llama.cpp parallelism to avoid linux oom
- Add the prototype to
include/graft/ops.h. - Implement
mg_op_<name>in the appropriatesrc/<area>/folder. - Register it in the dispatch table in
src/daemon/dispatch.c. - Add a CLI subcommand in
src/cli/main.c. - (Optional) Add a REST endpoint in
src/http/handlers.c+server.crouting. - Add
tests/test_<name>.ccovering happy path + 1–2 edge cases. - Update
docs/cli/README.md. - Update this wiki's Operations and CLI Reference pages.
- Add the field to
mg_config_tininclude/graft/config.h. - Parse it in
src/config/config.c. - Bump
config.example.yamlwith a comment block on rationale + range. - Document in this wiki's Configuration page.
- C11, no GCC/Clang extensions in headers.
- All public symbols prefixed
mg_(legacy name, kept for ABI stability). - Error type:
mg_err_t. Propagate viaMG_TRY(...)macro pattern. - No malloc on fixed-size hot paths (use the per-thread scratch in
mg_ctx_t). - Heap allocations on the cold paths use
mg_malloc/mg_free(instrumentable).
- Branch off master:
git checkout -b feat/whatever. - Squash if there are many small fixups; otherwise keep meaningful commits.
- PR description should answer: what changed, why, and what's the test?
- The CI matrix runs on Linux x86_64 only for now (macOS/Windows targets are temporarily off the matrix — see
release.ymlfor context).
Formula/graft.rb, bucket/graft.json, and third_party/* submodules pin specific revisions. Bumping any of them:
-
git -C third_party/<lib> checkout <new-sha>. - Update the
revision:inFormula/graft.rb. -
git addthe submodule pointer + the formula. - Open a PR titled
chore(deps): bump <lib> to <short-sha>.
These are open editorial items the maintainer should sweep at some point:
- README still calls the cross-encoder a stub — it isn't. (Code in
src/verify/crossencoder.cis complete.) - README mentions Host-header DNS-rebinding mitigation — couldn't find the validation in
src/http/server.c. Either implement it or remove the claim. -
graft profile remote synccurrently accepts only local file paths.docs/profiles/README.mdshould make that explicit (the wiki does).
Install it in one command, and integrate it through whatever surface fits (CLI, REST, MCP,hooks). No SaaS. No API key. One binary.
Get started · Install · Integrate · Source · Issues · Apache 2.0 · pre-1.0, alpha
Welcome
Concepts
Reference
Adjacent
Operations