Skip to content

Add autonomous memory support#6

Merged
bburda merged 11 commits intomainfrom
feat/autonomous-memory
Feb 10, 2026
Merged

Add autonomous memory support#6
bburda merged 11 commits intomainfrom
feat/autonomous-memory

Conversation

@bburda
Copy link
Owner

@bburda bburda commented Feb 9, 2026

No description provided.

Add pytest test suite with conftest fixtures (tmp_workspace, sample_needs,
needs_json_file) and tests for all core modules:
- test_config: type file mappings, ID prefix generation, labels
- test_engine: workspace discovery, needs loading, search, graph traversal
- test_formatter: brief, compact, context, full output formats
- test_rst: directive generation, RST append/update, tag operations
- test_scaffold: workspace initialization, conf.py, idempotency
- test_cli: integration tests for CLI subcommands

Add pytest-cov dependency, integration test markers, and Makefile with
install/test/lint targets.
Add 4-job CI workflow on Ubuntu 24.04 with Python 3.12:
- lint: ruff check + ruff format --check
- test-unit: pytest with integration marker exclusion
- test-integration: Sphinx build-dependent tests
- test-mcp: MCP server tool tests

Triggers on push to main and pull requests.
Add 'memory doctor' command that validates the installation environment:
- CLI entry point availability and version
- Workspace directory detection
- sphinx-build discoverability
- needs.json loadability and memory count
- MCP SDK installation status
- MCP server instantiation
- RST file integrity in memory directory

Reports pass/fail status for each check with actionable fix suggestions.
Add read-only analysis engine that detects maintenance issues:
- Duplicate detection via fuzzy title matching (SequenceMatcher >= 0.8)
  combined with tag overlap (>= 50% Jaccard similarity)
- Missing tag detection (entries without topic: or repo: tags)
- Stale entry detection (expired or review-overdue memories)
- Conflict detection (unlinked decisions on the same topic)
- Tag normalization (case-insensitive deduplication)
- Split file detection (RST files exceeding 50 entries)

Generates Action dataclass objects describing recommended fixes.
Includes run_plan() orchestrator and format_plan() for human/JSON output.
Add action execution engine that applies planner-generated actions:
- RETAG: add/remove tags on existing memories
- SUPERSEDE: replace old memory with new, linking via supersedes field
- DEPRECATE: mark memories as deprecated with optional replacement
- UPDATE: modify arbitrary fields (status, confidence, etc.)
- PRUNE: remove entries from RST files
- SPLIT_FILE: informational — notes files needing split

Safety features:
- Pre-validation with circular supersede chain detection
- Git stash/pop rollback on Sphinx rebuild failure
- Optional auto-commit after successful execution
- ExecutionResult with applied/failed/skipped tracking
Add git log analysis that generates memory candidates from commit history:
- Conventional commit classification: fix->mem, feat->fact, refactor->dec,
  BREAKING->risk, style->pref, docs->fact
- Scope extraction from conventional commit format (e.g., feat(api): ...)
- Tag inference from commit scope and changed file paths
- Related commit grouping by file overlap (Jaccard >= 0.3)
- Deduplication against existing memories using fuzzy title matching
  (SequenceMatcher >= 0.8) and tag overlap (>= 50%)

Supports configurable git range (--since/--until), minimum confidence
filtering, and human/JSON output formats.
Integrate planner, executor, and capture modules into the CLI:

- 'memory plan': analyze memory graph and generate maintenance actions.
  Supports --checks filter and --format (human/json) output.

- 'memory apply': execute planned actions from JSON file (--file) or
  by running plan inline (--plan). Supports --auto-commit, --no-rebuild,
  and -y/--yes for non-interactive use.

- 'memory capture git': extract memory candidates from git commit history.
  Supports --repo, --since/--until range, --min-confidence filter,
  --auto-add for direct ingestion, and --format output control.
Add 3 new MCP tools for LLM agent integration (11 total):

- memory_plan: analyze memory graph and return maintenance suggestions.
  Accepts optional checks filter and format parameter.

- memory_apply: execute a list of planned actions with rollback safety.
  Accepts actions array and optional auto_commit flag.

- memory_capture_git: extract memory candidates from git commit history.
  Supports repo_path, date range, confidence filter, and auto_add mode.

Update MCP test assertions to verify all 11 tools are registered.
Copilot AI review requested due to automatic review settings February 9, 2026 19:57
@bburda bburda self-assigned this Feb 9, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@bburda bburda changed the title Feat/autonomous memory Add autonomous memory support Feb 9, 2026
@bburda bburda requested a review from Copilot February 9, 2026 20:34
- Fix import sorting (I001) across cli.py and test files
- Remove unused imports (F401) in test_engine, test_formatter, test_rst
- Combine nested with statements (SIM117) in test_capture
- Add noqa comments for E402 in mcp_server.py (post-try/except imports)
- Rename unused loop variable (B007) in test_executor
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 17 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- capture.py: Use record/field separators (0x1e/0x1f) for git log parsing
  to handle multi-line commit bodies safely; fix since/until handling to
  distinguish date expressions from ref ranges; add explanatory comment
  on bare except clause
- executor.py: Check returncode in _git_stash_push before inspecting
  stdout; treat build failure as unsuccessful regardless of stash state;
  set success=False when any actions failed
- planner.py: Set field_changes={'status':'review'} in detect_conflicts
  instead of empty dict; raise ValueError for unknown check names
- mcp_server.py: Fix pipx install syntax from 'ai_memory_protocol/[mcp]'
  to '.[mcp]'
- cli.py: Remove unnecessary lambda wrappers around no-arg callables
- ci.yml: Add --cov-report=html for htmlcov/ artifact upload; add
  pytest-timeout to integration test dependencies
- Run ruff format on all files to fix formatting CI failure
@bburda bburda merged commit 07c34d0 into main Feb 10, 2026
6 checks passed
@bburda bburda deleted the feat/autonomous-memory branch February 10, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant