agent-activity 0.1.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.
@@ -0,0 +1,30 @@
1
+ name: Package checks
2
+ on:
3
+ push:
4
+ pull_request:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest, windows-latest]
14
+ python: ['3.11', '3.15']
15
+ runs-on: ${{ matrix.os }}
16
+ defaults:
17
+ run:
18
+ shell: bash
19
+ env:
20
+ PYTHONUTF8: '1'
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: ${{ matrix.python }}
26
+ - run: python -m pip install build 'mcp>=1.12,<2'
27
+ - run: python -m build
28
+ - run: python -m pip install dist/*.whl
29
+ - run: python -m unittest discover -s tests -v
30
+ - run: agent-activity --version
@@ -0,0 +1,85 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ name: Test Python ${{ matrix.python }} on ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: [ubuntu-latest, macos-latest, windows-latest]
19
+ python: ['3.11', '3.15']
20
+ env:
21
+ PYTHONUTF8: '1'
22
+ steps:
23
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
24
+ with:
25
+ persist-credentials: false
26
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
27
+ with:
28
+ python-version: ${{ matrix.python }}
29
+ - name: Install locked development tools
30
+ run: python -m pip install uv==0.12.17
31
+ - name: Run tests from the locked environment
32
+ run: |
33
+ uv sync --locked --group dev
34
+ uv run --locked --group dev python -m unittest discover -s tests -v
35
+
36
+ build:
37
+ name: Build and verify distributions
38
+ needs: test
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
42
+ with:
43
+ persist-credentials: false
44
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
45
+ with:
46
+ python-version: '3.11'
47
+ - name: Install locked development tools
48
+ run: python -m pip install uv==0.12.17
49
+ - name: Check release tag matches package version
50
+ shell: bash
51
+ run: |
52
+ uv sync --locked --group dev
53
+ package_version="$(uv run --locked --group dev python -c 'import agent_activity; print(agent_activity.__version__)')"
54
+ project_version="$(uv run --locked --group dev python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
55
+ test "$package_version" = "$project_version"
56
+ test "$GITHUB_REF_NAME" = "v$project_version"
57
+ - name: Audit locked dependencies
58
+ run: uv run --locked --group dev pip-audit --skip-editable
59
+ - name: Build wheel and source distribution
60
+ run: uv run --locked --group dev python -m build --sdist --wheel
61
+ - name: Validate distribution metadata
62
+ run: uv tool run --from twine twine check dist/*
63
+ - name: Smoke-test the installed wheel and MCP tools
64
+ run: uv run --locked --group dev python scripts/smoke_distribution.py dist/*.whl
65
+ - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
66
+ with:
67
+ name: python-package-distributions
68
+ path: dist/
69
+ if-no-files-found: error
70
+
71
+ publish:
72
+ name: Publish distributions to PyPI
73
+ needs: build
74
+ runs-on: ubuntu-latest
75
+ environment:
76
+ name: pypi
77
+ url: https://pypi.org/project/agent-activity/
78
+ permissions:
79
+ id-token: write
80
+ steps:
81
+ - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
82
+ with:
83
+ name: python-package-distributions
84
+ path: dist/
85
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ *.egg-info/
6
+ *.sqlite*
7
+ *.db*
8
+ *.agent-activity-*.bak
9
+ .env
10
+ .env.*
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ Notable changes to agent-activity are recorded here.
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Added
8
+
9
+ - Added current-release feature and potential future-work checklists.
10
+ - Added Makefile shortcuts for syncing development dependencies, testing, building,
11
+ running checks, and starting the MCP server.
12
+ - Added tag-triggered PyPI publishing with Trusted Publishing, cross-platform release
13
+ tests, dependency auditing, distribution validation, and an installed-wheel MCP
14
+ smoke test.
15
+
16
+ ## [0.1.0]
17
+
18
+ ### Added
19
+
20
+ - Local SQLite task memory with profile isolation, retry deduplication, and concurrent writers.
21
+ - JSON CLI and stdio MCP tools for recording, recalling, and checking activity.
22
+ - Setup integrations for OpenCode, Claude Code, Codex, Cursor, VS Code Copilot, and Gemini CLI.
23
+ - Portable configuration, database migrations, and cross-platform test coverage.
@@ -0,0 +1,13 @@
1
+ # Features
2
+
3
+ Capabilities in the current release:
4
+
5
+ - [x] Store concise agent task history in a local SQLite database.
6
+ - [x] Provide `record`, `recent`, and `health` stdio MCP tools.
7
+ - [x] Provide a JSON CLI for logging and querying activity.
8
+ - [x] Scope records by profile and project, with idempotent retry keys.
9
+ - [x] Support concurrent writers and preserve existing databases through schema migrations.
10
+ - [x] Install MCP configuration and recording/recall instructions for OpenCode, Claude Code,
11
+ Codex, Cursor, VS Code Copilot, and Gemini CLI.
12
+ - [x] Keep runtime dependencies at zero and support Python 3.11+.
13
+ - [x] Test storage, protocol behavior, integrations, and MCP SDK handshake flows.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Keith Connolly
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ UV ?= uv
2
+ PROFILE ?= default
3
+
4
+ .DEFAULT_GOAL := help
5
+ .PHONY: help sync test audit build package-check check release-check serve
6
+
7
+ help:
8
+ @printf '%s\n' \
9
+ 'agent-activity development tasks' \
10
+ ' make sync Sync development dependencies' \
11
+ ' make test Run the unittest suite' \
12
+ ' make audit Audit locked development dependencies' \
13
+ ' make build Build wheel and source distribution' \
14
+ ' make package-check Validate and smoke-test the wheel' \
15
+ ' make check Run tests and package checks' \
16
+ ' make release-check Run the complete release verification' \
17
+ ' make serve PROFILE=work Start the stdio MCP server'
18
+
19
+ sync:
20
+ $(UV) sync --locked --group dev
21
+
22
+ test:
23
+ $(UV) run --locked --group dev python -m unittest discover -s tests -v
24
+
25
+ audit:
26
+ $(UV) run --locked --group dev pip-audit --skip-editable
27
+
28
+ build:
29
+ $(UV) run --locked --group dev python -m build --sdist --wheel
30
+
31
+ package-check: build
32
+ $(UV) run --locked --group dev twine check dist/*
33
+ $(UV) run --locked --group dev python scripts/smoke_distribution.py dist/*.whl
34
+
35
+ check: test audit package-check
36
+
37
+ release-check: check
38
+
39
+ serve:
40
+ $(UV) run --locked --group dev agent-activity --profile "$(PROFILE)" serve
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.5
2
+ Name: agent-activity
3
+ Version: 0.1.0
4
+ Summary: Small, local SQLite task memory for coding agents, with a CLI and stdio MCP server.
5
+ Author: Keith Connolly
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: activity,agent,mcp,memory,sqlite
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+
16
+ # agent-activity
17
+
18
+ Small, local SQLite task memory for coding agents. Keep a useful history of what
19
+ was done, what was verified, and what actually happened, across sessions and
20
+ harnesses.
21
+
22
+ - One SQLite file and **zero runtime dependencies**. Python 3.11+.
23
+ - CLI plus three stdio MCP tools: `record`, `recent`, and `health`.
24
+ - Setup for OpenCode V2, Claude Code, Codex, Cursor, VS Code Copilot, and Gemini CLI.
25
+ - Named profiles, concurrent writers, and idempotent record retries.
26
+ - Portable configuration and a user-configurable SQLite database location.
27
+
28
+ ## Install
29
+
30
+ Install the command-line tool from PyPI:
31
+
32
+ ```sh
33
+ uv tool install agent-activity
34
+ # Or: pipx install agent-activity
35
+ ```
36
+
37
+ For development from a source checkout:
38
+
39
+ ```sh
40
+ uv tool install .
41
+ ```
42
+
43
+ Run setup from the project that should use memory:
44
+
45
+ ```sh
46
+ agent-activity install opencode --profile work
47
+ ```
48
+
49
+ Or make it available across your projects:
50
+
51
+ ```sh
52
+ agent-activity install claude-code --scope user --profile work
53
+ agent-activity install codex --scope user --profile work
54
+ ```
55
+
56
+ Setup writes the MCP configuration **and** the instructions to record and recall
57
+ tasks. Restart the harness afterward. Enable the server if your harness prompts,
58
+ then ask it to call the `activity` server's `health` tool. This checks the connection
59
+ without adding a record.
60
+
61
+ Use `--dry-run` to list affected files without creating files or opening SQLite:
62
+
63
+ ```sh
64
+ agent-activity install opencode --scope user --profile work --dry-run
65
+ ```
66
+
67
+ The installer preserves unrelated config and comments, replaces only the named
68
+ JSON server entry, and updates a marked instruction block. Existing changed files
69
+ get unique `.agent-activity-<id>.bak` backups. Repeating the
70
+ same installation makes no further changes. Codex TOML entries are managed inside
71
+ marked blocks; an existing unmarked server of the same name must be edited
72
+ manually or installed under a different `--name`.
73
+
74
+ ## Harness support
75
+
76
+ Project scope is the default. `--root /path/to/project` selects a different project.
77
+
78
+ | Harness argument | Project MCP config | Project instructions | User scope |
79
+ | --- | --- | --- | --- |
80
+ | `opencode` | `opencode.json(c)` or existing `.opencode/opencode.json(c)` | `AGENTS.md` | Yes, honors `OPENCODE_CONFIG_DIR` and `XDG_CONFIG_HOME` |
81
+ | `claude-code` | `.mcp.json` | `CLAUDE.md` | Yes |
82
+ | `codex` | `.codex/config.toml` | `AGENTS.md`, or existing `AGENTS.override.md` | Yes, honors `CODEX_HOME` |
83
+ | `cursor` | `.cursor/mcp.json` | `.cursor/rules/agent-activity.mdc`, always applied | Manual user rules, see below |
84
+ | `vscode` | `.mcp.json` | `.github/copilot-instructions.md` | Yes, for the current Copilot harness |
85
+ | `gemini` | `.gemini/settings.json` | `GEMINI.md` | Yes |
86
+
87
+ ```sh
88
+ agent-activity install cursor --profile personal
89
+ agent-activity install vscode --profile work
90
+ agent-activity install gemini --scope user --profile personal
91
+ ```
92
+
93
+ VS Code setup targets its current Copilot harness and the portable `mcpServers`
94
+ format. For older VS Code Local sessions using `.vscode/mcp.json`, copy the server
95
+ entry into the top-level `servers` object instead. VS Code's Claude and Codex
96
+ harnesses use their respective adapters.
97
+
98
+ Cursor user-wide setup needs its user rule UI: merge `config cursor` into
99
+ `~/.cursor/mcp.json`, then paste `instructions` into **Customize → Rules → User Rules**.
100
+ The automatic Cursor installer uses project rules so both halves are installed.
101
+
102
+ For any other stdio MCP client, launch:
103
+
104
+ ```sh
105
+ agent-activity --profile work serve
106
+ ```
107
+
108
+ Use these commands to get portable configuration and policy text:
109
+
110
+ ```sh
111
+ agent-activity config claude-code --profile work
112
+ agent-activity config codex --profile work
113
+ agent-activity instructions --profile work
114
+ ```
115
+
116
+ `config` prints a fragment, not a replacement for the whole harness configuration.
117
+ `install` and `config` use the portable `agent-activity` executable name. Install
118
+ it on each machine and make it available on the harness's PATH, including for GUI
119
+ applications. Default configuration contains no home-directory, interpreter, or
120
+ database paths from the machine running setup. Database paths are included only
121
+ when explicitly supplied with `--db`; quote a path starting with `~` to preserve
122
+ it for expansion on the machine running the server.
123
+
124
+ ## Profiles and storage
125
+
126
+ The default file is `~/.agent-activity/activity.sqlite`. Path precedence:
127
+
128
+ 1. `--db /path/to/file.sqlite`
129
+ 2. `AGENT_ACTIVITY_DB`
130
+ 3. The default path above
131
+
132
+ Each server resolves its database path when it starts. A relative `--db` path is
133
+ relative to the server's working directory; a path starting with `~` resolves
134
+ against that machine's user home.
135
+
136
+ The profile defaults to `AGENT_ACTIVITY_PROFILE`, then `default`. Choose `work`,
137
+ `personal`, or any 1-64 character name using letters, digits, `.`, `_`, and `-`.
138
+ Profiles are fixed when the server starts, never supplied through MCP tool input.
139
+
140
+ Point different harnesses at the same database and profile to share history.
141
+ Use separate profiles to keep work and personal recall separate:
142
+
143
+ ```sh
144
+ agent-activity --profile work recent
145
+ agent-activity --profile personal recent
146
+ ```
147
+
148
+ Profile scoping is enforced by the tools, not an OS security boundary. A user with
149
+ filesystem access can read the complete file. POSIX databases are mode `600` and
150
+ the default memory directory is `700`; Windows uses the account's directory ACLs.
151
+
152
+ ## Tools and CLI
153
+
154
+ | Tool | Purpose |
155
+ | --- | --- |
156
+ | `record` | Save one task's sanitized summary and outcome, with a stable retry key |
157
+ | `recent` | Read the latest records for the profile, optionally filtered by project |
158
+ | `health` | SQLite integrity check and profile-scoped record count |
159
+
160
+ `record` requires `project` (a canonical repository name or `null`), `action_type`,
161
+ `summary`, `outcome`, and `event_key`. Optional `metadata` is a JSON object.
162
+ The profile cannot be changed by tool arguments.
163
+
164
+ ```sh
165
+ agent-activity --profile work log example-app investigation \
166
+ "Traced the retry path" "Verified the failure handling" --event-key unique-task-key
167
+ agent-activity --profile work project example-app 10
168
+ agent-activity --profile work today
169
+ agent-activity --profile work general
170
+ agent-activity --profile work projects
171
+ agent-activity --profile work types
172
+ agent-activity --profile work health
173
+ ```
174
+
175
+ CLI output is JSON. `log` accepts `-` for general work and an optional final JSON
176
+ metadata object. Without `--event-key`, each CLI invocation generates a UUID.
177
+ CLI and MCP retry scopes are separate. Identical retries in the same profile/scope
178
+ return the original ID; reusing a key with different content fails.
179
+
180
+ OpenCode's session extension provides a hashed session retry scope.
181
+ Other clients need no extension: choose a unique task key, such as a UUID, and
182
+ reuse it only for retries. Raw session IDs are not stored.
183
+
184
+ Action types: `setup`, `code_change`, `investigation`, `review`, `config_change`,
185
+ `test`, `deploy`, `blocked`, and `note`.
186
+
187
+ ## How memory gets written
188
+
189
+ The installed policy asks the agent to recall relevant activity when resuming
190
+ work and record one meaningful completed or blocked task before the final reply.
191
+ The MCP server also supplies the same policy during initialization.
192
+
193
+ Recording depends on the model following these instructions. Retry deduplication
194
+ does not guarantee that every task will be recorded. The package doesn't collect
195
+ transcripts, backfill old sessions, or run background summarization.
196
+
197
+ Store concise outcomes and verification details. Callers must omit secrets, raw
198
+ prompts/tool output, customer data, source snippets, and signed URLs. The package
199
+ does not automatically redact arbitrary sensitive content.
200
+
201
+ ## Existing databases
202
+
203
+ Select an existing compatible database explicitly:
204
+
205
+ ```sh
206
+ agent-activity --profile work --db /path/to/existing/activity.sqlite health
207
+ ```
208
+
209
+ Schema migration preserves existing rows and retry keys. Older unscoped rows
210
+ are retained under `legacy`, never assigned to a guessed profile. The auxiliary
211
+ `observations`, `artifacts`, `tags`, and `action_tags` tables are retained.
212
+
213
+ Use `--profile` or `AGENT_ACTIVITY_PROFILE` to select a namespace. Automatic setup
214
+ writes an explicit profile into each server command. Keep one activity server
215
+ enabled per harness/profile.
216
+
217
+ ## Updating and removing
218
+
219
+ Update the tool from a new wheel or checkout. Keep the `agent-activity` executable
220
+ on the harness's PATH and keep the database outside the package folder.
221
+
222
+ To remove an integration, delete the named MCP entry (or its marked TOML block)
223
+ and the `agent-activity` marked instruction block. Restore a printed backup if
224
+ you want the exact pre-install file. For Cursor, remove the dedicated `.mdc` file
225
+ if it contains only this package's rule.
226
+
227
+ ```sh
228
+ uv tool uninstall agent-activity
229
+ # Or: pipx uninstall agent-activity
230
+ ```
231
+
232
+ The database is retained. Use SQLite's backup API for live database backups;
233
+ copying only the main file can miss uncheckpointed journal/WAL data.
234
+
235
+ ## Development and distribution
236
+
237
+ ```sh
238
+ make sync
239
+ make release-check
240
+ ```
241
+
242
+ Release checks run the test suite, audit locked development dependencies, build
243
+ both distributions, validate their metadata, and install the wheel in an isolated
244
+ environment for an MCP smoke test. The CI workflow tests on Linux, macOS, and
245
+ Windows; see [verification and release notes](docs/releasing.md).
246
+
247
+ There are no service accounts, API keys, hosted services, or model subscriptions
248
+ required by this package itself.
249
+
250
+ ## License and attribution
251
+
252
+ Copyright (c) 2026 Keith Connolly. Released under the [MIT License](LICENSE).
253
+
254
+ You may use, modify, share, sublicense, and sell this software, including in
255
+ commercial and closed-source projects. Keep the copyright and license notice in
256
+ copies or substantial portions of the software, as required by the MIT License.
257
+
258
+ Additional credit to Keith Connolly in your documentation or acknowledgments is
259
+ appreciated, but is not an additional license requirement.
260
+
261
+ The software is provided "as is", without warranty. See [LICENSE](LICENSE) for
262
+ the full terms and limitation of liability.