Skip to content

implemented longitudinal context retrieval for AI reflection - #119

Open
Sonmale25 wants to merge 2 commits into
sugarlabs:mainfrom
Sonmale25:feat-longitudinal-memory
Open

implemented longitudinal context retrieval for AI reflection#119
Sonmale25 wants to merge 2 commits into
sugarlabs:mainfrom
Sonmale25:feat-longitudinal-memory

Conversation

@Sonmale25

Copy link
Copy Markdown

I’ve implemented a new /history/summary endpoint that allows the system to retrieve and condense past reflection data. Technically, this prepares the LLM's "System Prompt" with a growth-oriented context, enabling it to ask longitudinal questions (e.g., "How have you improved on the loop logic you started yesterday?").

Key Changes:

Added GET /history/summary/{activity_id} in main.py.

Implemented the summarization logic in ai.py using the existing LLM integration.

Designed a flexible mock interface for historical data to ensure future compatibility with the sugar-datastore.

Testing Performed:

Verified the new endpoint appears and functions in the Swagger UI (/docs).

Confirmed the server starts cleanly even with no historical data (graceful fallback).

Ensured no PII is exposed in the summary JSON.

This commit introduces the GET /history/summary/{activity_id} endpoint and its supporting AI logic to generate Growth Summaries from past student reflections. By analyzing historical struggles and goals, this feature moves the AI beyond stateless interactions, enabling it to act as a long-term pedagogical mentor. The output format is explicitly designed to be injected into future system prompts, helping students contextualize their current work within their broader learning journey. PII is strictly excluded from these summaries to ensure student privacy. Currently, the endpoint uses mock reflection data, laying the foundation for future integration with the sugar-datastore.
Implement a GET /history/summary/{activity_id} endpoint to enable cross-session memory. This allows the AI to summarize past reflections from the Sugar Journal, transforming the 'stateless' chatbot into a long-term pedagogical mentor that can track a learner's cognitive growth over time.
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.

1 participant