Skip to content

feat: Oracle activity reporting — cross-project daily digest (v2.38.0)#18

Merged
drknowhow merged 1 commit into
mainfrom
feat/oracle-activity-reporter-v2.38.0
Jun 14, 2026
Merged

feat: Oracle activity reporting — cross-project daily digest (v2.38.0)#18
drknowhow merged 1 commit into
mainfrom
feat/oracle-activity-reporter-v2.38.0

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

Summary

Makes the Oracle an activity reporter: a cross-project "what happened today" digest aggregating sessions, tool calls, edits, git mutations, and token/cost. Returned as structured JSON with an optional LLM-narrated prose summary.

Previously the Oracle could expose code/memory intelligence to external LLMs but had no way to report user activity or sessions. The data already existed per project (.c3/activity_log.jsonl, .c3/session_stats.jsonl, .c3/edit_ledger.jsonl) but was siloed and only surfaced one project at a time.

What's included

  • ActivityReporter (oracle/services/activity_reporter.py) — aggregates per-project activity from .c3 JSONL via ActivityLog / SessionManager / EditLedger for a UTC day (or since/until window), across all registered projects or one via project_path. Reads directly off disk (no C3Runtime build); skips non-C3 projects without side effects. Optional narrate=true adds a best-effort Ollama prose digest (never fails the structured result).
  • activity_report discovery tool (read tier) in TOOL_SPECS. The registry is the single source of truth, so one spec auto-exposes the tool on REST (/api/discovery/call), OpenAPI, MCP, and the internal Oracle chat. Dispatch wired through ChatEngine.
  • GET /api/activity/digest endpoint (date / since / until / project / narrate) + an Activity tab in oracle.html (date picker, totals cards, optional narrative, per-project breakdown table).
  • Version bump 2.37.0 → 2.38.0.

Docs

README, oracle-guide/api-reference.md, oracle-guide/discovery-api.md, oracle-guide/changelog.md, the in-app cli/guide/oracle.html tool table, and CHANGELOG.

Testing

  • New tests/test_activity_reporter.py (windowing, totals, single-project filter, non-C3 skip, narrate-error); extended test_oracle_discovery_api.py + test_tool_registry.py.
  • 28/28 pass. oracle_server imports cleanly.
  • End-to-end against real .c3 data: today's digest returned 192 tool calls, 43 edits, 35 git mutations. (Sessions/tokens are 0 here — no session formally saved today and the token-capturing Stop hook isn't active — correct behavior.)

🤖 Generated with Claude Code

The Oracle can now produce a cross-project "what happened today" digest:
sessions, tool calls, edits, git mutations, and token/cost. Exposed as a
discovery tool (MCP + REST + OpenAPI + internal chat), a dedicated endpoint,
and a web-UI tab.

- ActivityReporter (oracle/services/activity_reporter.py): aggregates per-project
  activity from .c3 JSONL (ActivityLog / SessionManager / EditLedger) for a UTC day
  or since/until window; skips non-C3 projects without side effects; optional
  best-effort Ollama narration (never fails the structured result).
- activity_report discovery tool (read tier) in TOOL_SPECS — one registry spec
  auto-exposes it on REST, OpenAPI, and MCP. Dispatch wired through ChatEngine.
- GET /api/activity/digest endpoint + Activity tab in oracle.html (date picker,
  totals cards, optional narrative, per-project breakdown).
- Tests: tests/test_activity_reporter.py + extended discovery/registry tests (28 pass).
- Docs: README, oracle-guide/{api-reference,discovery-api,changelog}.md, in-app
  cli/guide/oracle.html tool table, CHANGELOG; version bump to 2.38.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 14, 2026 11:28
@drknowhow drknowhow merged commit e6e8c61 into main Jun 14, 2026
12 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds cross-project activity reporting to the Oracle, exposing a daily (UTC) digest of sessions, tool calls, edits/git mutations, and token/cost both as a Discovery tool (activity_report) and as a first-class Oracle UI/API feature.

Changes:

  • Introduces ActivityReporter to aggregate per-project .c3/*.jsonl artifacts into a structured digest, with optional best-effort LLM narration.
  • Exposes the digest via: activity_report in TOOL_SPECS, ChatEngine dispatch, and a new GET /api/activity/digest endpoint + “Activity” dashboard tab.
  • Adds/updates tests and documentation, and bumps the package version to 2.38.0.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_tool_registry.py Verifies activity_report is read-tier and callable with empty args.
tests/test_oracle_discovery_api.py Ensures the Discovery API lists and dispatches activity_report.
tests/test_activity_reporter.py New unit tests for digest windowing, totals, filtering, non-C3 skipping, and narrate failure handling.
README.md Documents the new activity digest surfaces (tool, endpoint, UI tab).
pyproject.toml Version bump to 2.38.0.
oracle/services/tool_registry.py Adds activity_report tool spec to the canonical tool catalog.
oracle/services/chat_engine.py Wires activity_report into tool defs, init injection, and dispatcher.
oracle/services/activity_reporter.py Implements cross-project digest aggregation + optional narration.
oracle/oracle.html Adds an “Activity” tab and client-side rendering of the digest.
oracle/oracle_server.py Initializes ActivityReporter and adds GET /api/activity/digest.
oracle-guide/discovery-api.md Adds activity_report to the read-tier tool list.
oracle-guide/changelog.md Changelog entry describing activity reporting.
oracle-guide/api-reference.md Adds API reference docs for GET /api/activity/digest.
cli/guide/oracle.html Updates in-app guide tool table to include activity_report.
cli/c3.py Version bump to 2.38.0.
CHANGELOG.md Adds 2.38.0 release notes for Oracle activity reporting.

Comment on lines +60 to +64
for proj in self._target_projects(project_path):
pr = self._report_project(proj, lo, hi)
if (pr["tool_calls"] or pr["edits"] or pr["git_mutations"]
or pr["sessions"] or pr["decisions"]):
proj_reports.append(pr)
Comment on lines +143 to +146
try:
counts: dict[str, int] = {}
for e in ActivityLog(path).get_recent(limit=10000, since=lo, until=hi):
etype = e.get("type", "unknown")
Comment on lines +171 to +174
# Token / cost from hook-captured session stats.
for st in sm.get_session_stats(500):
ts = st.get("ts", "")
if ts and lo <= ts <= hi:
@drknowhow drknowhow deleted the feat/oracle-activity-reporter-v2.38.0 branch June 14, 2026 11:33
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.

2 participants