Skip to content

Add agent flat-file context store and wire into onboarding + SIF agents#408

Merged
AJaySi merged 1 commit intomainfrom
codex/design-flat-file-context-system-for-ai-agents-goxbcd
Mar 12, 2026
Merged

Add agent flat-file context store and wire into onboarding + SIF agents#408
AJaySi merged 1 commit intomainfrom
codex/design-flat-file-context-system-for-ai-agents-goxbcd

Conversation

@AJaySi
Copy link
Owner

@AJaySi AJaySi commented Mar 11, 2026

Motivation

  • Provide a deterministic, ultra-fast read path for AI agents by persisting canonical onboarding snapshots to a per-user flat-file workspace to reduce latency for repetitive agent reads.
  • Ensure agent tooling has a safe, isolated, and size-governed context layer with clear fallback to the database and SIF semantic index when flat files are missing or stale.

Description

  • Add AgentFlatContextStore (services/intelligence/agent_flat_context.py) implementing atomic JSON writes, sensitive-key redaction, payload-size trimming, per-step save/load helpers, and a manifest index.
  • Persist onboarding snapshots into the flat context from onboarding flows by updating StepManagementService to save Step 2 (website analysis), Step 3 (research preferences), Step 4 (persona), and Step 5 (integrations) to the flat store.
  • Extend SIF agent surfaces by adding txtai agent tools and flat-file reader/writer hooks in services/intelligence/sif_agents.py, and add a fallback-aware retrieval API in services/intelligence/sif_integration.py to fetch step context via flat file -> database -> semantic index.
  • Add comprehensive design and operational docs under docs/flat_file_context/ and a note in the SIF architecture docs describing the fast-context layer and retrieval order.

Testing

  • Ran the backend unit test suite via pytest against modified modules and observed no regressions (all unit tests passed).
  • Executed onboarding integration smoke tests exercising StepManagementService save flows for steps 2–5 and validated flat files and manifest were created and readable (smoke tests succeeded).
  • Performed basic agent-tool smoke checks using SIFIntegrationService.get_step2_website_context and the txtai flat-context tools to confirm the flat-file -> DB -> semantic fallback behavior worked (smoke checks succeeded).

Codex Task

@AJaySi AJaySi merged commit 901470e into main Mar 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant