feat: time-aware Super Contexte synthesis

- knowledge.py: classify trades by maturity before building synthesis
  prompt; only mature trades (≥35% elapsed) contribute to P&L stats
  and conclusions; immature trades listed for transparency only
- Add 6h staleness gate on POST /synthesize (force=true to override)
- System prompt now includes hard timing rule: GPT-4o must not revise
  existing conclusions because of newly-added immature trades
- useApi.ts: useSynthesizeKnowledge accepts force boolean param
- SuperContexte.tsx: shows amber notice with age when skipped + offers
  "Force quand même" button; success banner uses new response shape

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-16 23:57:46 +02:00
parent 9075762dd5
commit 22687dfd03
3 changed files with 118 additions and 33 deletions

View File

@@ -526,11 +526,14 @@ export const useKnowledgeEntries = () =>
export const useSynthesizeKnowledge = () => {
const qc = useQueryClient()
return useMutation({
mutationFn: () => api.post('/knowledge/synthesize').then(r => r.data),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['knowledge-state'] })
qc.invalidateQueries({ queryKey: ['knowledge-history'] })
qc.invalidateQueries({ queryKey: ['knowledge-entries'] })
mutationFn: (force: boolean = false) =>
api.post(`/knowledge/synthesize${force ? '?force=true' : ''}`).then(r => r.data),
onSuccess: (_data) => {
if (!_data?.skipped) {
qc.invalidateQueries({ queryKey: ['knowledge-state'] })
qc.invalidateQueries({ queryKey: ['knowledge-history'] })
qc.invalidateQueries({ queryKey: ['knowledge-entries'] })
}
},
})
}