cogito-mem 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cogito_mem-0.2.0/.claude-plugin/marketplace.json +17 -0
- cogito_mem-0.2.0/.claude-plugin/plugin.json +55 -0
- cogito_mem-0.2.0/.dockerignore +12 -0
- cogito_mem-0.2.0/.github/workflows/docker.yml +122 -0
- cogito_mem-0.2.0/.github/workflows/pages.yml +32 -0
- cogito_mem-0.2.0/.github/workflows/release.yml +52 -0
- cogito_mem-0.2.0/.github/workflows/tests.yml +73 -0
- cogito_mem-0.2.0/.gitignore +216 -0
- cogito_mem-0.2.0/Dockerfile +73 -0
- cogito_mem-0.2.0/LICENSE +21 -0
- cogito_mem-0.2.0/PKG-INFO +90 -0
- cogito_mem-0.2.0/README.md +71 -0
- cogito_mem-0.2.0/compose.yaml +16 -0
- cogito_mem-0.2.0/docs/benchmarks.md +89 -0
- cogito_mem-0.2.0/docs/development.md +26 -0
- cogito_mem-0.2.0/docs/explainer/cogi_squirrel.html +1290 -0
- cogito_mem-0.2.0/docs/growth-plan.md +125 -0
- cogito_mem-0.2.0/docs/install.md +148 -0
- cogito_mem-0.2.0/docs/literature/agent_memory_systems.md +456 -0
- cogito_mem-0.2.0/docs/literature/memory_api_notation_and_digests.md +156 -0
- cogito_mem-0.2.0/docs/notes/agent_memory_atlas_20261017.html +838 -0
- cogito_mem-0.2.0/docs/notes/competitors_20261020.md +325 -0
- cogito_mem-0.2.0/docs/notes/first-user-session.md +72 -0
- cogito_mem-0.2.0/docs/notes/locomo_comparison_20261019.html +429 -0
- cogito_mem-0.2.0/docs/notes/memory_tape_v0_20261017.html +614 -0
- cogito_mem-0.2.0/docs/reference.md +146 -0
- cogito_mem-0.2.0/docs/requirements.md +723 -0
- cogito_mem-0.2.0/hooks/hooks.json +34 -0
- cogito_mem-0.2.0/install.ps1 +20 -0
- cogito_mem-0.2.0/install.sh +29 -0
- cogito_mem-0.2.0/pyproject.toml +41 -0
- cogito_mem-0.2.0/scripts/make_tiny_embeddinggemma2.py +191 -0
- cogito_mem-0.2.0/server.json +36 -0
- cogito_mem-0.2.0/site/404.html +51 -0
- cogito_mem-0.2.0/site/api.html +147 -0
- cogito_mem-0.2.0/site/assets/cogi-card.png +0 -0
- cogito_mem-0.2.0/site/assets/cogi-icon.png +0 -0
- cogito_mem-0.2.0/site/assets/cogi.svg +26 -0
- cogito_mem-0.2.0/site/assets/site.js +35 -0
- cogito_mem-0.2.0/site/assets/style.css +228 -0
- cogito_mem-0.2.0/site/how.html +134 -0
- cogito_mem-0.2.0/site/index.html +106 -0
- cogito_mem-0.2.0/site/privacy.html +78 -0
- cogito_mem-0.2.0/site/reports/locomo-2026-10-19.html +368 -0
- cogito_mem-0.2.0/site/results.html +177 -0
- cogito_mem-0.2.0/site/safety.html +106 -0
- cogito_mem-0.2.0/site/start.html +157 -0
- cogito_mem-0.2.0/src/cogito_mem/__init__.py +29 -0
- cogito_mem-0.2.0/src/cogito_mem/__main__.py +3 -0
- cogito_mem-0.2.0/src/cogito_mem/api.py +226 -0
- cogito_mem-0.2.0/src/cogito_mem/capture/__init__.py +128 -0
- cogito_mem-0.2.0/src/cogito_mem/capture/claude_code.py +253 -0
- cogito_mem-0.2.0/src/cogito_mem/capture/codex.py +130 -0
- cogito_mem-0.2.0/src/cogito_mem/capture/exports.py +143 -0
- cogito_mem-0.2.0/src/cogito_mem/cli.py +464 -0
- cogito_mem-0.2.0/src/cogito_mem/client.py +198 -0
- cogito_mem-0.2.0/src/cogito_mem/doctor.py +102 -0
- cogito_mem-0.2.0/src/cogito_mem/embedding.py +205 -0
- cogito_mem-0.2.0/src/cogito_mem/errors.py +44 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/__init__.py +1 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/common.py +88 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/locomo.py +300 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/locomo_qa.py +694 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/longmemeval.py +335 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/longmemeval_recall.py +361 -0
- cogito_mem-0.2.0/src/cogito_mem/evals/speed.py +314 -0
- cogito_mem-0.2.0/src/cogito_mem/ids.py +51 -0
- cogito_mem-0.2.0/src/cogito_mem/install.py +447 -0
- cogito_mem-0.2.0/src/cogito_mem/keyword.py +77 -0
- cogito_mem-0.2.0/src/cogito_mem/mcp_server.py +238 -0
- cogito_mem-0.2.0/src/cogito_mem/memory.py +401 -0
- cogito_mem-0.2.0/src/cogito_mem/names.py +174 -0
- cogito_mem-0.2.0/src/cogito_mem/recall.py +292 -0
- cogito_mem-0.2.0/src/cogito_mem/runtime.py +510 -0
- cogito_mem-0.2.0/src/cogito_mem/server.py +278 -0
- cogito_mem-0.2.0/src/cogito_mem/split.py +108 -0
- cogito_mem-0.2.0/src/cogito_mem/store.py +561 -0
- cogito_mem-0.2.0/src/cogito_mem/terms.py +39 -0
- cogito_mem-0.2.0/src/cogito_mem/timeutil.py +64 -0
- cogito_mem-0.2.0/src/cogito_mem/tokenizer.py +76 -0
- cogito_mem-0.2.0/tests/conftest.py +51 -0
- cogito_mem-0.2.0/tests/fixtures.py +170 -0
- cogito_mem-0.2.0/tests/test_acceptance.py +200 -0
- cogito_mem-0.2.0/tests/test_api.py +354 -0
- cogito_mem-0.2.0/tests/test_capture.py +255 -0
- cogito_mem-0.2.0/tests/test_core.py +339 -0
- cogito_mem-0.2.0/tests/test_evals.py +336 -0
- cogito_mem-0.2.0/tests/test_install.py +260 -0
- cogito_mem-0.2.0/tests/test_longmemeval_recall.py +183 -0
- cogito_mem-0.2.0/tests/test_names.py +229 -0
- cogito_mem-0.2.0/tests/test_recall.py +309 -0
- cogito_mem-0.2.0/tests/test_runtime.py +285 -0
- cogito_mem-0.2.0/tests/test_service.py +345 -0
- cogito_mem-0.2.0/tests/test_site.py +43 -0
- cogito_mem-0.2.0/uv.lock +409 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cogito-mem",
|
|
3
|
+
"description": "cogito-mem: a fast, simple, local long-term memory for Claude Code and other agents.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "meridian21lab",
|
|
6
|
+
"url": "https://github.com/meridian21lab"
|
|
7
|
+
},
|
|
8
|
+
"plugins": [
|
|
9
|
+
{
|
|
10
|
+
"name": "cogito-mem",
|
|
11
|
+
"source": "./",
|
|
12
|
+
"description": "Local long-term memory for Claude Code. Cogi saves every message you and Claude exchange, word for word, and brings back what matters with each prompt. No API key, no cloud: nothing leaves your machine.",
|
|
13
|
+
"category": "productivity",
|
|
14
|
+
"homepage": "https://meridian21lab.github.io/cogito-mem/"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cogito-mem",
|
|
3
|
+
"displayName": "cogito-mem (Cogi)",
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"description": "Local long-term memory for Claude Code. Cogi saves every message you and Claude exchange, word for word, and brings back what matters with each prompt. No API key, no cloud: nothing leaves your machine.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "meridian21lab",
|
|
8
|
+
"url": "https://github.com/meridian21lab"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://meridian21lab.github.io/cogito-mem/",
|
|
11
|
+
"repository": "https://github.com/meridian21lab/cogito-mem",
|
|
12
|
+
"documentationUrl": "https://meridian21lab.github.io/cogito-mem/",
|
|
13
|
+
"supportUrl": "https://github.com/meridian21lab/cogito-mem/issues",
|
|
14
|
+
"privacyPolicyUrl": "https://meridian21lab.github.io/cogito-mem/privacy.html",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"icon": "./site/assets/cogi-icon.png",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"memory",
|
|
19
|
+
"long-term-memory",
|
|
20
|
+
"local-first",
|
|
21
|
+
"privacy",
|
|
22
|
+
"recall",
|
|
23
|
+
"context",
|
|
24
|
+
"session",
|
|
25
|
+
"mcp",
|
|
26
|
+
"embeddings",
|
|
27
|
+
"llama.cpp"
|
|
28
|
+
],
|
|
29
|
+
"userConfig": {
|
|
30
|
+
"memory_name": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"title": "Name your memory",
|
|
33
|
+
"description": "Where Cogi keeps your nuts. Leave empty for <your username>-hollow. Letters, digits, . _ - (up to 64).",
|
|
34
|
+
"required": false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"cogi": {
|
|
39
|
+
"command": "uv",
|
|
40
|
+
"args": [
|
|
41
|
+
"run",
|
|
42
|
+
"--frozen",
|
|
43
|
+
"--quiet",
|
|
44
|
+
"--no-dev",
|
|
45
|
+
"--project",
|
|
46
|
+
"${CLAUDE_PLUGIN_ROOT}",
|
|
47
|
+
"cogito-mem",
|
|
48
|
+
"mcp"
|
|
49
|
+
],
|
|
50
|
+
"env": {
|
|
51
|
+
"CLAUDE_PLUGIN_OPTION_MEMORY_NAME": "${user_config.memory_name}"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
name: docker
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
tags: ["v*"]
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
packages: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
# Both architectures build natively on every change, so an arm64-only break never reaches main.
|
|
15
|
+
image:
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
include:
|
|
20
|
+
- platform: linux/amd64
|
|
21
|
+
runner: ubuntu-latest
|
|
22
|
+
- platform: linux/arm64
|
|
23
|
+
runner: ubuntu-24.04-arm
|
|
24
|
+
runs-on: ${{ matrix.runner }}
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: docker/setup-buildx-action@v3
|
|
28
|
+
- name: Build
|
|
29
|
+
uses: docker/build-push-action@v6
|
|
30
|
+
with:
|
|
31
|
+
context: .
|
|
32
|
+
platforms: ${{ matrix.platform }}
|
|
33
|
+
load: true
|
|
34
|
+
tags: cogito-mem:ci
|
|
35
|
+
cache-from: type=gha,scope=${{ matrix.platform }}
|
|
36
|
+
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
|
|
37
|
+
- name: Smoke test (keyword search; the model is not downloaded in CI)
|
|
38
|
+
run: |
|
|
39
|
+
docker run -d --name cm -p 127.0.0.1:7327:7327 -e COGITO_MEM_NO_DOWNLOAD=1 cogito-mem:ci
|
|
40
|
+
for i in $(seq 1 60); do curl -fs http://127.0.0.1:7327/v1/status >/dev/null && break; sleep 1; done
|
|
41
|
+
curl -fs http://127.0.0.1:7327/v1/memory -H 'Content-Type: application/json' \
|
|
42
|
+
-d '{"op":"append","items":[{"author":"ci","text":"The container answers queries."}]}'
|
|
43
|
+
curl -fs http://127.0.0.1:7327/v1/memory -H 'Content-Type: application/json' \
|
|
44
|
+
-d '{"op":"query","text":"container answers"}' | grep -q "The container answers queries."
|
|
45
|
+
curl -fsi http://127.0.0.1:7327/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
|
|
46
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}' \
|
|
47
|
+
| grep -qi "mcp-session-id"
|
|
48
|
+
docker exec cm /opt/llama/llama-server --version
|
|
49
|
+
docker logs cm
|
|
50
|
+
|
|
51
|
+
# Each architecture builds natively (compiling llama.cpp under emulation takes hours), pushes by
|
|
52
|
+
# digest, and the merge job joins the digests into one multi-arch tag.
|
|
53
|
+
publish:
|
|
54
|
+
if: github.event_name == 'push'
|
|
55
|
+
needs: image
|
|
56
|
+
strategy:
|
|
57
|
+
matrix:
|
|
58
|
+
include:
|
|
59
|
+
- platform: linux/amd64
|
|
60
|
+
runner: ubuntu-latest
|
|
61
|
+
- platform: linux/arm64
|
|
62
|
+
runner: ubuntu-24.04-arm
|
|
63
|
+
runs-on: ${{ matrix.runner }}
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
- uses: docker/setup-buildx-action@v3
|
|
67
|
+
- uses: docker/login-action@v3
|
|
68
|
+
with:
|
|
69
|
+
registry: ghcr.io
|
|
70
|
+
username: ${{ github.actor }}
|
|
71
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
72
|
+
- name: Build and push by digest
|
|
73
|
+
id: build
|
|
74
|
+
uses: docker/build-push-action@v6
|
|
75
|
+
with:
|
|
76
|
+
context: .
|
|
77
|
+
platforms: ${{ matrix.platform }}
|
|
78
|
+
outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
|
|
79
|
+
cache-from: type=gha,scope=${{ matrix.platform }}
|
|
80
|
+
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
|
|
81
|
+
- name: Export digest
|
|
82
|
+
run: |
|
|
83
|
+
mkdir -p "$RUNNER_TEMP/digests"
|
|
84
|
+
digest="${{ steps.build.outputs.digest }}"
|
|
85
|
+
touch "$RUNNER_TEMP/digests/${digest#sha256:}"
|
|
86
|
+
- uses: actions/upload-artifact@v4
|
|
87
|
+
with:
|
|
88
|
+
name: digest-${{ strategy.job-index }}
|
|
89
|
+
path: ${{ runner.temp }}/digests/*
|
|
90
|
+
retention-days: 1
|
|
91
|
+
|
|
92
|
+
merge:
|
|
93
|
+
needs: publish
|
|
94
|
+
runs-on: ubuntu-latest
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/download-artifact@v4
|
|
97
|
+
with:
|
|
98
|
+
path: ${{ runner.temp }}/digests
|
|
99
|
+
pattern: digest-*
|
|
100
|
+
merge-multiple: true
|
|
101
|
+
- uses: docker/setup-buildx-action@v3
|
|
102
|
+
- uses: docker/login-action@v3
|
|
103
|
+
with:
|
|
104
|
+
registry: ghcr.io
|
|
105
|
+
username: ${{ github.actor }}
|
|
106
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
107
|
+
- name: Tags
|
|
108
|
+
id: meta
|
|
109
|
+
uses: docker/metadata-action@v5
|
|
110
|
+
with:
|
|
111
|
+
images: ghcr.io/${{ github.repository }}
|
|
112
|
+
tags: |
|
|
113
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
|
114
|
+
type=semver,pattern={{version}}
|
|
115
|
+
type=sha,format=short
|
|
116
|
+
- name: Create the multi-arch tags
|
|
117
|
+
working-directory: ${{ runner.temp }}/digests
|
|
118
|
+
run: |
|
|
119
|
+
docker buildx imagetools create \
|
|
120
|
+
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
121
|
+
$(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
|
|
122
|
+
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: pages
|
|
2
|
+
|
|
3
|
+
# Publishes site/ (plain HTML, no build step) to https://meridian21lab.github.io/cogito-mem/.
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
paths: ["site/**", ".github/workflows/pages.yml"]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pages: write
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: pages
|
|
17
|
+
cancel-in-progress: false
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
deploy:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
environment:
|
|
23
|
+
name: github-pages
|
|
24
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/configure-pages@v5
|
|
28
|
+
- uses: actions/upload-pages-artifact@v3
|
|
29
|
+
with:
|
|
30
|
+
path: site
|
|
31
|
+
- id: deployment
|
|
32
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Tag a version (git tag v0.2.0 && git push origin v0.2.0) to publish it to PyPI, the MCP Registry and GitHub.
|
|
4
|
+
# PyPI publishing uses trusted publishing: add this repository and this workflow as a
|
|
5
|
+
# trusted publisher of the `cogito-mem` project on pypi.org once, before the first tag.
|
|
6
|
+
# The MCP Registry entry (server.json, io.github.meridian21lab/cogito-mem) is proved by GitHub OIDC and by the
|
|
7
|
+
# `mcp-name:` line in the README, which becomes the PyPI description.
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
publish:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
environment: pypi
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: astral-sh/setup-uv@v6
|
|
23
|
+
- name: Check the tag matches every version (package, plugin, MCP Registry entry)
|
|
24
|
+
run: |
|
|
25
|
+
python3 - <<'PY'
|
|
26
|
+
import json, os, tomllib
|
|
27
|
+
tag = os.environ["GITHUB_REF_NAME"]
|
|
28
|
+
versions = {
|
|
29
|
+
"pyproject.toml": tomllib.load(open("pyproject.toml", "rb"))["project"]["version"],
|
|
30
|
+
"plugin.json": json.load(open(".claude-plugin/plugin.json"))["version"],
|
|
31
|
+
"server.json": json.load(open("server.json"))["version"],
|
|
32
|
+
"server.json package": json.load(open("server.json"))["packages"][0]["version"],
|
|
33
|
+
}
|
|
34
|
+
wrong = {k: v for k, v in versions.items() if f"v{v}" != tag}
|
|
35
|
+
assert not wrong, f"tag {tag} does not match {wrong}"
|
|
36
|
+
PY
|
|
37
|
+
- name: Build
|
|
38
|
+
run: uv build
|
|
39
|
+
- name: Publish to PyPI
|
|
40
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
41
|
+
- name: Publish to the MCP Registry
|
|
42
|
+
run: |
|
|
43
|
+
curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher
|
|
44
|
+
./mcp-publisher login github-oidc
|
|
45
|
+
# the registry checks the new PyPI release, which can take a minute to appear
|
|
46
|
+
for attempt in 1 2 3 4 5; do ./mcp-publisher publish && exit 0; sleep 30; done
|
|
47
|
+
exit 1
|
|
48
|
+
- name: GitHub release
|
|
49
|
+
uses: softprops/action-gh-release@v2
|
|
50
|
+
with:
|
|
51
|
+
files: dist/*
|
|
52
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, dev]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, macos-latest]
|
|
15
|
+
python: ["3.10", "3.13"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python }}
|
|
21
|
+
- name: Install
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install -e '.[test]' mcp anyio
|
|
25
|
+
- name: Test
|
|
26
|
+
env:
|
|
27
|
+
COGITO_MEM_NO_DOWNLOAD: "1"
|
|
28
|
+
run: pytest -q -rs
|
|
29
|
+
- name: Validate the Claude Code plugin
|
|
30
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
|
|
31
|
+
run: |
|
|
32
|
+
npm install -g @anthropic-ai/claude-code
|
|
33
|
+
claude plugin validate . --strict
|
|
34
|
+
- name: Installer script
|
|
35
|
+
if: matrix.python == '3.13'
|
|
36
|
+
env:
|
|
37
|
+
COGITO_MEM_NO_DOWNLOAD: "1"
|
|
38
|
+
COGITO_MEM_SOURCE: ${{ github.workspace }}
|
|
39
|
+
run: |
|
|
40
|
+
export HOME="$RUNNER_TEMP/home" && mkdir -p "$HOME/.claude"
|
|
41
|
+
sh install.sh claude-code
|
|
42
|
+
"$HOME/.cogito-mem/bin/cogito-mem" query "install check" --json
|
|
43
|
+
"$HOME/.cogito-mem/bin/cogito-mem" stop
|
|
44
|
+
|
|
45
|
+
llama:
|
|
46
|
+
# The llama.cpp path end to end: build llama-server, write a tiny random-weight
|
|
47
|
+
# EmbeddingGemma 2 GGUF with the real tokenizer, run every test with it.
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
env:
|
|
50
|
+
LLAMA_CPP_COMMIT: ff5a23376725e5a889fa0bfb987b7541dc304da0
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
- uses: actions/setup-python@v5
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.13"
|
|
56
|
+
- name: Build llama-server
|
|
57
|
+
run: |
|
|
58
|
+
git init llama.cpp && cd llama.cpp
|
|
59
|
+
git remote add origin https://github.com/ggml-org/llama.cpp
|
|
60
|
+
git fetch --depth 1 origin "$LLAMA_CPP_COMMIT" && git checkout FETCH_HEAD
|
|
61
|
+
cmake -B build -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFF -DLLAMA_OPENSSL=OFF \
|
|
62
|
+
-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF
|
|
63
|
+
cmake --build build --target llama-server -j 4
|
|
64
|
+
- name: Install
|
|
65
|
+
run: pip install -e '.[test]' mcp anyio pyyaml
|
|
66
|
+
- name: Tiny model
|
|
67
|
+
run: python scripts/make_tiny_embeddinggemma2.py --llama-cpp llama.cpp --out tiny.gguf
|
|
68
|
+
- name: Test
|
|
69
|
+
env:
|
|
70
|
+
COGITO_MEM_NO_DOWNLOAD: "1"
|
|
71
|
+
COGITO_MEM_TEST_LLAMA_SERVER: ${{ github.workspace }}/llama.cpp/build/bin/llama-server
|
|
72
|
+
COGITO_MEM_TEST_MODEL: ${{ github.workspace }}/tiny.gguf
|
|
73
|
+
run: pytest -q -rs
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
*.lcov
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
# Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# uv
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
# poetry.lock
|
|
110
|
+
# poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
# pdm.lock
|
|
117
|
+
# pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
# pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi/*
|
|
127
|
+
!.pixi/config.toml
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule*
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Spyder project settings
|
|
163
|
+
.spyderproject
|
|
164
|
+
.spyproject
|
|
165
|
+
|
|
166
|
+
# Rope project settings
|
|
167
|
+
.ropeproject
|
|
168
|
+
|
|
169
|
+
# site/ is the docs site's source (published by .github/workflows/pages.yml), so it is kept
|
|
170
|
+
|
|
171
|
+
# mypy
|
|
172
|
+
.mypy_cache/
|
|
173
|
+
.dmypy.json
|
|
174
|
+
dmypy.json
|
|
175
|
+
|
|
176
|
+
# Pyre type checker
|
|
177
|
+
.pyre/
|
|
178
|
+
|
|
179
|
+
# pytype static type analyzer
|
|
180
|
+
.pytype/
|
|
181
|
+
|
|
182
|
+
# Cython debug symbols
|
|
183
|
+
cython_debug/
|
|
184
|
+
|
|
185
|
+
# PyCharm
|
|
186
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
187
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
189
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
190
|
+
# .idea/
|
|
191
|
+
|
|
192
|
+
# Abstra
|
|
193
|
+
# Abstra is an AI-powered process automation framework.
|
|
194
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
195
|
+
# Learn more at https://abstra.io/docs
|
|
196
|
+
.abstra/
|
|
197
|
+
|
|
198
|
+
# Visual Studio Code
|
|
199
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
|
200
|
+
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
201
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
|
202
|
+
# could uncomment the following to ignore the entire vscode folder
|
|
203
|
+
# .vscode/
|
|
204
|
+
# Temporary file for partial code execution
|
|
205
|
+
tempCodeRunnerFile.py
|
|
206
|
+
|
|
207
|
+
# Ruff stuff:
|
|
208
|
+
.ruff_cache/
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1.7
|
|
2
|
+
#
|
|
3
|
+
# cogito-mem in one container: the memory service, llama.cpp's llama-server, and
|
|
4
|
+
# (with BAKE_MODEL=1) the EmbeddingGemma 2 model.
|
|
5
|
+
#
|
|
6
|
+
# docker build -t cogito-mem .
|
|
7
|
+
# docker run -d --name cogito-mem -p 127.0.0.1:7327:7327 -v cogito-mem:/data cogito-mem
|
|
8
|
+
# claude mcp add --transport http cogito-mem http://127.0.0.1:7327/mcp
|
|
9
|
+
#
|
|
10
|
+
# Without BAKE_MODEL the model (310 MB) is downloaded into the /data volume on first start.
|
|
11
|
+
# Behind a TLS-inspecting proxy, pass its CA for the build only (it is not kept in the image):
|
|
12
|
+
# docker build --secret id=extra_ca,src=/path/to/proxy-ca.pem ...
|
|
13
|
+
|
|
14
|
+
# Debian 13: its GCC 14 compiles llama.cpp's newest ARM variants (armv9.2 with SME); GCC 12 cannot.
|
|
15
|
+
ARG PYTHON_IMAGE=python:3.12-slim-trixie
|
|
16
|
+
|
|
17
|
+
# ---------------------------------------------------------------- llama.cpp
|
|
18
|
+
FROM ${PYTHON_IMAGE} AS llama
|
|
19
|
+
ARG LLAMA_CPP_REF=ff5a23376725e5a889fa0bfb987b7541dc304da0
|
|
20
|
+
WORKDIR /src
|
|
21
|
+
# Portable CPU build: every x86/ARM variant is compiled and the best one is picked at run time.
|
|
22
|
+
RUN --mount=type=secret,id=extra_ca,required=false \
|
|
23
|
+
cat /etc/ssl/certs/ca-certificates.crt /run/secrets/extra_ca > /tmp/ca.pem 2>/dev/null \
|
|
24
|
+
|| cp /etc/ssl/certs/ca-certificates.crt /tmp/ca.pem \
|
|
25
|
+
&& sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources \
|
|
26
|
+
&& apt-get -o Acquire::https::CaInfo=/tmp/ca.pem update -qq \
|
|
27
|
+
&& apt-get -o Acquire::https::CaInfo=/tmp/ca.pem install -y -qq --no-install-recommends build-essential cmake git \
|
|
28
|
+
&& rm -rf /var/lib/apt/lists/* \
|
|
29
|
+
&& git init -q llama.cpp && cd llama.cpp \
|
|
30
|
+
&& git remote add origin https://github.com/ggml-org/llama.cpp \
|
|
31
|
+
&& GIT_SSL_CAINFO=/tmp/ca.pem git fetch -q --depth 1 origin "${LLAMA_CPP_REF}" && git checkout -q FETCH_HEAD \
|
|
32
|
+
&& cmake -B build -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFF -DLLAMA_OPENSSL=OFF \
|
|
33
|
+
-DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON \
|
|
34
|
+
-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF \
|
|
35
|
+
&& cmake --build build --target llama-server -j"$(nproc)" \
|
|
36
|
+
&& mkdir -p /opt/llama && cp -P build/bin/llama-server build/bin/*.so* /opt/llama/ \
|
|
37
|
+
&& rm -f /tmp/ca.pem
|
|
38
|
+
|
|
39
|
+
# ---------------------------------------------------------------- runtime
|
|
40
|
+
FROM ${PYTHON_IMAGE}
|
|
41
|
+
ARG BAKE_MODEL=0
|
|
42
|
+
LABEL io.modelcontextprotocol.server.name="io.github.meridian21lab/cogito-mem" \
|
|
43
|
+
org.opencontainers.image.title="cogito-mem" \
|
|
44
|
+
org.opencontainers.image.description="A fast, simple, local memory for agents (append/query, MCP)" \
|
|
45
|
+
org.opencontainers.image.source="https://github.com/meridian21lab/cogito-mem" \
|
|
46
|
+
org.opencontainers.image.licenses="MIT"
|
|
47
|
+
COPY --from=llama /opt/llama /opt/llama
|
|
48
|
+
COPY pyproject.toml README.md LICENSE /src/
|
|
49
|
+
COPY src /src/src
|
|
50
|
+
RUN --mount=type=secret,id=extra_ca,required=false \
|
|
51
|
+
cat /etc/ssl/certs/ca-certificates.crt /run/secrets/extra_ca > /tmp/ca.pem 2>/dev/null \
|
|
52
|
+
|| cp /etc/ssl/certs/ca-certificates.crt /tmp/ca.pem \
|
|
53
|
+
&& sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources \
|
|
54
|
+
&& apt-get -o Acquire::https::CaInfo=/tmp/ca.pem update -qq \
|
|
55
|
+
&& apt-get -o Acquire::https::CaInfo=/tmp/ca.pem install -y -qq --no-install-recommends libgomp1 \
|
|
56
|
+
&& rm -rf /var/lib/apt/lists/* \
|
|
57
|
+
&& PIP_CERT=/tmp/ca.pem pip install --no-cache-dir --root-user-action=ignore /src && rm -rf /src \
|
|
58
|
+
&& if [ "${BAKE_MODEL}" = "1" ]; then \
|
|
59
|
+
SSL_CERT_FILE=/tmp/ca.pem COGITO_MEM_HOME=/opt/cogito-mem cogito-mem setup --model-only \
|
|
60
|
+
&& echo "COGITO_MEM_MODEL=/opt/cogito-mem/models/embeddinggemma-2-Q8_0.gguf" > /etc/cogito-mem.env; \
|
|
61
|
+
else : > /etc/cogito-mem.env; fi \
|
|
62
|
+
&& rm -f /tmp/ca.pem
|
|
63
|
+
ENV COGITO_MEM_HOME=/data \
|
|
64
|
+
COGITO_MEM_LLAMA_SERVER=/opt/llama/llama-server \
|
|
65
|
+
LD_LIBRARY_PATH=/opt/llama \
|
|
66
|
+
COGITO_MEM_ALLOWED_HOSTS=host.docker.internal,cogito-mem \
|
|
67
|
+
PYTHONUNBUFFERED=1
|
|
68
|
+
VOLUME /data
|
|
69
|
+
EXPOSE 7327
|
|
70
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s \
|
|
71
|
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7327/v1/status', timeout=4)"
|
|
72
|
+
# /etc/cogito-mem.env points at a baked model, when there is one
|
|
73
|
+
ENTRYPOINT ["sh", "-c", "set -a; . /etc/cogito-mem.env; set +a; exec cogito-mem serve --host 0.0.0.0 --port 7327 --idle-timeout 0 \"$@\"", "--"]
|
cogito_mem-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Meridian21Lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|