Add project phase tracking and firm knowledge context for agents#100
Merged
Conversation
Adds real phase-by-phase mission tracking (ESQ/APS/.../AOR) per project via a new project_phase_history table and a small tracker UI on ProjectDetail, then wires that history plus the firm's price catalog, DPGF cost history, and CCTP excerpts into a new opt-in "firm_knowledge" agent context scope so AI agent suggestions reflect the cabinet's own track record instead of generic architectural knowledge. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ruo4H7HxCTkiNKX9wweHt9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces project phase history tracking (ESQ/APS/APD/PC/PRO/DCE/ACT/VISA/DET/AOR) and exposes firm-specific benchmarks to AI agents via a new
firm_knowledgecontext scope. Architects can now track which mission phase each project is in, view phase transition history, and agents can reference real historical data (phase durations, price catalogs, DPGF costs, CCTP templates) when making recommendations.Key Changes
Database & Schema
project_phase_history— tracks phase transitions withentered_atandexited_attimestampsschema.sqlwith RLS policies(tenant_id, project_id)for efficient queriesBackend API (
server.ts)/api/projects/:id/phase-history— fetch all phase transitions for a project/api/projects/:id/phase— set current phase (auto-closes previous phase, logs activity)Agent Context & System Prompt
firm_knowledgetoAgentContextScopetypesummarizePhaseBenchmarks()— averages phase durations (min 2 samples per phase)summarizeCostHistory()— aggregates DPGF item prices by designation/unitfirm_knowledgescope — agents without it don't pay token costFrontend UI (
ProjectDetail.tsx)handleSetPhase()to update via APITypes & Localization
ProjectPhaseHistoryEntryinterfacefirm_knowledgeto agent config UI with descriptive labelImplementation Details
designation|unitekey to group variantshttps://claude.ai/code/session_01Ruo4H7HxCTkiNKX9wweHt9