mirror of
https://github.com/computerim/impactflow-discovery.git
synced 2026-08-27 07:30:35 +00:00
Phase 4: task-to-goal integration (Vision side)
Build the boundary the ImpactFlow core time-tracker plugs into. A task maps to a foundation — one of the six stable profile elements (love, strength, mission, vocation, short_term, long_term) — so the tracker can ask "which goal does this build toward?" and post the answer back to Vision. - Models + migration 006: task_mapping (one row per logged time entry). - app/services/foundations.py: the six foundations + a pure, testable work-pattern aggregator (rollup) and a plain-language summary. - app/routers/integration.py (user-scoped; tracker calls as the user or via X-API-Key): GET /foundations, POST/GET /task-mappings, GET /work-patterns?days=N (per-foundation minutes/share/neglected). - Reminder engine now pulls from real work patterns: CheckinCoach takes an optional work-pattern summary (last 14 days) and reflects where time has gone against the person's own words — an observation, never a verdict. - Frontend: dashboard.html (time per foundation + neglected); linked from profile.html. Documented the core-tracker integration contract in the README. Phase 4 completes the Vision module's roadmap on the Discovery side; the core tracker integrates by calling these endpoints. Tests: 86 passing (added pure-aggregator, integration-endpoint, and work-pattern-into-check-in tests; run in-container). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -27,6 +27,11 @@ from app.services.coaching import (
|
||||
CheckinError,
|
||||
generate_preferences,
|
||||
)
|
||||
from app.services.foundations import work_pattern_text
|
||||
from app.routers.integration import work_patterns_for
|
||||
|
||||
# Look-back window (days) for the work-pattern signal fed into a check-in.
|
||||
_WORK_PATTERN_DAYS = 14
|
||||
|
||||
router = APIRouter(prefix="/discovery/coaching", tags=["coaching"])
|
||||
|
||||
@@ -206,8 +211,13 @@ async def _generate_checkin(
|
||||
api_key = os.getenv("ANTHROPIC_API_KEY")
|
||||
model = os.getenv("ANTHROPIC_MODEL", "claude-sonnet-4-6")
|
||||
coach = CheckinCoach(api_key=api_key, model=model)
|
||||
# Phase 4: feed recent work patterns into the check-in so it can reflect
|
||||
# where time has actually gone against the person's stated direction.
|
||||
summary = await work_patterns_for(db, user_id, _WORK_PATTERN_DAYS)
|
||||
body = await coach.generate(
|
||||
_profile_dict(profile), _prefs_out(prefs).model_dump()
|
||||
_profile_dict(profile),
|
||||
_prefs_out(prefs).model_dump(),
|
||||
work_patterns=work_pattern_text(summary, _WORK_PATTERN_DAYS),
|
||||
)
|
||||
checkin = CoachingCheckin(
|
||||
id=str(uuid.uuid4()),
|
||||
|
||||
Reference in New Issue
Block a user