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:
Joel Salmon
2026-06-16 21:24:58 -05:00
parent 50453901b3
commit c4fc1cccd7
16 changed files with 857 additions and 5 deletions
+14 -2
View File
@@ -97,8 +97,12 @@ THE PERSON'S OWN WORDS (their profile):
HOW THEY WANT TO BE COACHED:
{prefs}
RECENT WORK PATTERNS (from their time tracker, may be empty):
{work_patterns}
YOUR TASK:
- Write a short check-in (3-5 sentences) that QUOTES the person's own words back to them — a specific phrase from their goals or their sense of purpose, in quotation marks.
- If recent work patterns are given, you may gently reflect what they show (e.g. where their time has and hasn't gone) — but only as an observation to check against their own words. Never tell them it is good or bad.
- Then ask, gently and openly, whether that direction still feels true for them right now. Invite them to say if anything has shifted.
ABSOLUTE RULES (mirror, not compass):
@@ -140,12 +144,20 @@ class CheckinCoach:
)
async def generate(
self, profile: Dict[str, Any], prefs: Dict[str, Any]
self,
profile: Dict[str, Any],
prefs: Dict[str, Any],
work_patterns: str | None = None,
) -> str:
"""Produce the check-in body text. Raises CheckinError on failure."""
"""Produce the check-in body text. Raises CheckinError on failure.
``work_patterns`` is an optional plain-language summary of recent logged
work (Phase 4); when present the coach may reflect it back as an
observation to check against the person's own words."""
system = SYSTEM_PROMPT.format(
profile=self._profile_block(profile),
prefs=self._prefs_block(prefs),
work_patterns=work_patterns or "(no recent work logged)",
style=prefs.get("coaching_style", "warm"),
prefer_questions=prefs.get("prefer_questions_over_directives", True),
)