Skip to content

feat: add cli stats#431

Open
MiloszPodsiadly wants to merge 3 commits intoMemPalace:developfrom
MiloszPodsiadly:feat/add-cli-stats
Open

feat: add cli stats#431
MiloszPodsiadly wants to merge 3 commits intoMemPalace:developfrom
MiloszPodsiadly:feat/add-cli-stats

Conversation

@MiloszPodsiadly
Copy link
Copy Markdown

What does this PR do?

Adds a new CLI command:

mempalace stats

This command provides a quick overview of the current palace contents by showing counts for:

  • Wings
  • Halls
  • Rooms
  • Memories

It helps users quickly understand what has been indexed without needing to inspect storage manually.


How to test

mempalace --help
mempalace --palace .\tmp\missing_palace stats
mempalace init .\demo
mempalace mine .\demo
mempalace stats

Expected:

  • missing palace → helpful error message
  • after mining → non-zero counts (Memories, Rooms, etc.)

Checklist

  • Added CLI parser entry for stats
  • Added command dispatch for stats
  • Added implementation in mempalace/cli.py
  • Added tests for missing palace, summary output, and dispatch
  • Updated docs and instructions

Validation

  • ruff check . passes
  • New stats-related tests pass
  • Full offline test suite passes

The failing tests appear unrelated to this change and are caused by existing Chroma/embedding download paths that require network access.
Errors occur in searcher, miner, and mcp_server tests and result in httpx.ConnectError (WinError 10013) in offline environments.

The stats command:

  • does not use embeddings
  • does not perform network calls
  • only reads metadata from the local Chroma collection

Notes

This is a small, self-contained CLI feature intended as a safe and minimal contribution.

@MiloszPodsiadly MiloszPodsiadly changed the title Feat/add cli stats feat: add cli stats Apr 9, 2026
Copy link
Copy Markdown

@web3guru888 web3guru888 left a comment

Choose a reason for hiding this comment

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

Clean implementation. The batch-fetching approach in _palace_stats() is smart — avoids loading the entire collection into memory at once.

A couple of thoughts:

  • Consider adding hall counts too, since halls are a core palace concept. The metadata is already there.
  • The stats vs status naming might confuse users — worth mentioning in the help text how they differ (stats = numeric counts, status = structural overview).
  • The tests look solid, especially testing the missing-palace error path.

Nice minimal contribution — this is the kind of quick utility that's genuinely useful for debugging.

🔭 Reviewed as part of the MemPalace-AGI integration project — autonomous research with perfect memory. Community interaction updates are posted regularly on the dashboard.

@MiloszPodsiadly
Copy link
Copy Markdown
Author

stats now reports hall counts from metadata["hall"] alongside wings, rooms, and memories. It stays strictly data-driven, so if hall metadata is missing, the observed count is simply 0.

I also updated the CLI help text to better distinguish:

  • status as a structural overview
  • stats as numeric counts

Tests now also cover the missing-hall-metadata case, in addition to the existing missing-palace path.

@web3guru888
Copy link
Copy Markdown

Great — the hall counts addition is exactly what I had in mind, and the graceful fallback for missing hall metadata is the right call. Data-driven counts are always safer than assumptions about what metadata exists.

One small note on the help text distinction (status = structural overview, stats = numeric counts): that's a clean separation. In our setup we tend to reach for stats first when we want a quick sanity check after a mine run — having it return structured counts rather than a status narrative makes it easy to script around.

@MiloszPodsiadly
Copy link
Copy Markdown
Author

Thanks for the review — really appreciate it.

@bensig bensig changed the base branch from main to develop April 11, 2026 22:22
@igorls igorls added area/cli CLI commands enhancement New feature or request labels Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants