From fc3a189e5be487e80cdb3d00ae9e08da6bcc700c Mon Sep 17 00:00:00 2001 From: Jer Miller Date: Fri, 17 Apr 2026 22:55:44 -0600 Subject: [PATCH] =?UTF-8?q?refactor(pipeline):=20rename=20dream=20?= =?UTF-8?q?=E2=86=92=20think/thinking=20across=20codebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clean-break rename of the background-analysis pipeline. No aliases, no compat shims: `sol dream` is gone, `think.dream` is unimportable. - Subcommand `sol dream` → `sol think` - Module `think/dream.py` → `think/thinking.py` (asymmetric by design: verb is `think`, module noun is `thinking`, class is `ThinkingJSONLWriter`) - Callosum tract `"dream"` → `"think"` - Health sidecar filenames drop `_dream`: `{ref}_{mode}.jsonl` and `{ref}_{mode}.log` (no `_think` replacement) - `apps/entities/events.py` dead `dream.generators_completed` listener removed (handler subscribed to an event the pipeline never emitted) Pre-rename journal logs under `journal/**/*_dream.{log,jsonl}` are left untouched as historical artifacts (accepted history blackout). Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitignore | 4 +- AGENTS.md | 2 +- apps/entities/events.py | 64 +---- apps/health/call.py | 2 +- apps/health/tests/test_call.py | 2 +- apps/health/workspace.html | 94 +++---- apps/home/routes.py | 8 +- apps/sol/routes.py | 2 +- apps/speakers/talent/speakers/SKILL.md | 4 +- docs/APPS.md | 6 +- docs/BACKLOG.md | 2 +- docs/CALLOSUM.md | 22 +- docs/CORTEX.md | 6 +- docs/SOLCLI.md | 4 +- docs/THINK.md | 14 +- docs/design/yesterdays-processing-card.md | 22 +- observe/observer_client.py | 2 +- scripts/gate_agents_rename.py | 2 +- skills/solstone/SKILL.md | 2 +- sol.py | 6 +- talent/chat.md | 4 +- talent/heartbeat.md | 4 +- talent/journal/references/facets.md | 2 +- tests/baselines/api/sol/preview.json | 2 +- tests/baselines/api/talents/preview.json | 2 +- tests/test_activities.py | 8 +- tests/test_health_cli.py | 4 +- tests/test_heartbeat.py | 22 +- tests/test_home_yesterdays_processing.py | 22 +- tests/test_pipeline_health.py | 16 +- tests/test_pipeline_smoke.py | 14 +- tests/test_runner.py | 22 +- tests/test_scheduler.py | 10 +- tests/test_segment.py | 2 +- tests/test_sol.py | 2 +- tests/test_supervisor.py | 2 +- tests/test_supervisor_schedule.py | 20 +- ...eam_activity.py => test_think_activity.py} | 72 +++--- ...dream_dry_run.py => test_think_dry_run.py} | 14 +- ...{test_dream_full.py => test_think_full.py} | 10 +- ...dream_segment.py => test_think_segment.py} | 230 +++++++++--------- think/cortex.py | 4 +- think/pipeline_health.py | 6 +- think/runner.py | 6 +- think/scheduler.py | 2 +- think/segment.py | 2 +- think/supervisor.py | 64 ++--- think/talent_cli.py | 2 +- think/talents.py | 2 +- think/{dream.py => thinking.py} | 44 ++-- think/top.py | 48 ++-- 51 files changed, 436 insertions(+), 498 deletions(-) rename tests/{test_dream_activity.py => test_think_activity.py} (94%) rename tests/{test_dream_dry_run.py => test_think_dry_run.py} (83%) rename tests/{test_dream_full.py => test_think_full.py} (91%) rename tests/{test_dream_segment.py => test_think_segment.py} (85%) rename think/{dream.py => thinking.py} (98%) diff --git a/.gitignore b/.gitignore index af8f556b5..1a4607d74 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ logs/ .coverage tests/fixtures/journal/agents/*/*.jsonl tests/fixtures/journal/tokens/*.json -tests/fixtures/journal/*/health/*_dream.jsonl -tests/fixtures/journal/chronicle/*/health/*_dream.jsonl +tests/fixtures/journal/*/health/*.jsonl +tests/fixtures/journal/chronicle/*/health/*.jsonl *.sqlite *.sqlite-shm *.sqlite-wal diff --git a/AGENTS.md b/AGENTS.md index af948284c..20ac015b8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,7 +43,7 @@ make dev # Start stack (Ctrl+C to stop) Cogitate talents have access to all `sol` commands. The following infrastructure commands must never be called by talents because they manage services and data pipelines that should only be operated by the supervisor or a human operator: - `sol supervisor` / `sol start` -- `sol dream` except heartbeat's targeted `sol dream --segment` +- `sol think` except heartbeat's targeted `sol think --segment` - `sol import` - `sol config` - `sol cortex` diff --git a/apps/entities/events.py b/apps/entities/events.py index 6f86a91d1..c7120528e 100644 --- a/apps/entities/events.py +++ b/apps/entities/events.py @@ -1,66 +1,4 @@ # SPDX-License-Identifier: AGPL-3.0-only # Copyright (c) 2026 sol pbc -"""Entity activity tracking via Callosum event handlers. - -Updates last_seen on attached entities when they appear in daily outputs. -Triggered after dream processing completes for each day. -""" - -import logging - -from apps.events import EventContext, on_event -from think.entities import parse_knowledge_graph_entities, touch_entities_from_activity -from think.facets import get_facets - -logger = logging.getLogger(__name__) - - -@on_event("dream", "generators_completed") -def update_entity_activity(ctx: EventContext) -> None: - """Update last_seen for entities mentioned in today's knowledge graph. - - Triggered after generator processing completes. Parses the knowledge graph - for entity names and updates last_seen on matching attached entities - across all facets. - """ - # Only process daily mode (knowledge graph is a daily insight) - if ctx.msg.get("mode") != "daily": - return - - day = ctx.msg.get("day") - if not day: - logger.warning("generators_completed event missing day field") - return - - # Parse entity names from knowledge graph - kg_names = parse_knowledge_graph_entities(day) - if not kg_names: - logger.debug(f"No entities found in knowledge graph for {day}") - return - - logger.info(f"Found {len(kg_names)} entities in knowledge graph for {day}") - - # Update each facet's attached entities - facets = get_facets() - total_updated = 0 - total_matched = 0 - - for facet_name in facets: - result = touch_entities_from_activity(facet_name, kg_names, day) - matched_count = len(result["matched"]) - updated_count = len(result["updated"]) - - if matched_count > 0: - logger.info( - f"Facet '{facet_name}': matched {matched_count}, " - f"updated {updated_count} entities for {day}" - ) - total_matched += matched_count - total_updated += updated_count - - if total_matched > 0: - logger.info( - f"Entity activity update complete for {day}: " - f"{total_matched} matches, {total_updated} updates across {len(facets)} facets" - ) +"""Entity activity tracking via Callosum event handlers.""" diff --git a/apps/health/call.py b/apps/health/call.py index 8f8ed1a7c..68f28ae74 100644 --- a/apps/health/call.py +++ b/apps/health/call.py @@ -25,7 +25,7 @@ def pipeline( False, "--yesterday", help="Summarize yesterday's pipeline." ), ) -> None: - """Summarize dream pipeline health for one day.""" + """Summarize think pipeline health for one day.""" if day is not None and yesterday: typer.echo("--day and --yesterday are mutually exclusive", err=True) raise typer.Exit(1) diff --git a/apps/health/tests/test_call.py b/apps/health/tests/test_call.py index 5c9f4c61b..c62b7990a 100644 --- a/apps/health/tests/test_call.py +++ b/apps/health/tests/test_call.py @@ -57,7 +57,7 @@ def test_mutual_exclusion_error(health_env): def test_pipeline_with_real_fixture(health_env): env = health_env() day = "20260101" - health_path = env.journal / day / "health" / "123_segment_dream.jsonl" + health_path = env.journal / day / "health" / "123_segment.jsonl" health_path.parent.mkdir(parents=True, exist_ok=True) health_path.write_text( "\n".join( diff --git a/apps/health/workspace.html b/apps/health/workspace.html index 3728f5826..96e8c72c6 100644 --- a/apps/health/workspace.html +++ b/apps/health/workspace.html @@ -784,16 +784,16 @@ color: #a78bfa; } -/* Dream Card */ -.dream-card { +/* Think Card */ +.think-card { border-left: 4px solid #f59e0b; } -.dream-card.hidden { +.think-card.hidden { display: none; } -.dream-info { +.think-info { display: flex; flex-wrap: wrap; gap: 1.5em; @@ -812,17 +812,17 @@ color: #6b7280; } -.dream-progress { +.think-progress { margin-bottom: 0.75em; } -.dream-progress-label { +.think-progress-label { font-size: 0.85em; color: #374151; margin-bottom: 0.3em; } -.dream-progress-bar { +.think-progress-bar { width: 100%; height: 6px; background: #e5e7eb; @@ -830,13 +830,13 @@ overflow: hidden; } -.dream-progress-fill { +.think-progress-fill { height: 100%; background: #f59e0b; transition: width 0.3s ease; } -.dream-agents { +.think-agents { font-size: 0.85em; color: #6b7280; margin-top: 0.5em; @@ -1211,14 +1211,14 @@ - -