Дата: 2026-04-03 Автор: Coordinator (AI) Статус: 📝 HL_DRAFT — Updated after RESEARCH (RES-TFW-18)
Знания проекта сейчас теряются между чатами. Агенты выполняют задачи, в ходе работы узнают о проекте новые факты — архитектурные ограничения, внешние зависимости, бизнес-контекст, поведение инфраструктуры — но нигде их не фиксируют. RF записывает Observations (tech debt), но не записывает что агент узнал о проекте. Знания остаются в чате и пропадают.
Три проблемы:
Вдохновение: Claude Code «dream» — 4-фазный процесс (Orient → Gather → Consolidate → Prune). TFW адаптирует эту идею: сбор через артефакты (не чаты), консолидация через
/tfw-knowledge, mandatory gate каждые N задач.Validated by RESEARCH (RES-TFW-18): Design aligns with Zettelkasten (fleeting→permanent notes), LangMem (hot-path + background consolidation), Claude Code (topic files + index). See RES for full analysis.
| Артефакт | Что записывается | Что теряется |
|---|---|---|
| RF §5 Observations | Tech debt (code smells, missing tests) | Факты о проекте: бизнес-контекст, инфра, пользователи, среда |
| REVIEW §3 Tech Debt | Observations → triage | Факты из REVIEW сессии (reviewer видит вещи, которых executor не видел) |
| RES (full doc) | Decisions, open questions | Факты о домене, обнаруженные при исследовании |
| ONB §6 Inconsistencies | Code vs spec | Факты о расхождениях code/spec/reality |
| Аспект | Состояние |
|---|---|
| Trigger | After REVIEW or manual |
| Input | RF observations + architecture changes |
| Process | 5-item checklist (arch? decision? deprecated? debt? principle?) |
| Output | KNOWLEDGE.md sections 0-4 + TECH_DEBT.md |
| Missing | No fact collection. No contradiction check. No pruning. No mandatory schedule |
| Аспект | Состояние |
|---|---|
| File | Не существует |
| Content | Язык, тон, стиль, привычки — нигде не записаны |
| Scope | Cross-project (одна персона, разные проекты) |
| Аспект | Состояние |
|---|---|
| Current | Нет. tfw-docs запускается когда пользователь вспомнит |
| Pipeline | ⬜ TODO → 📝 HL_DRAFT → ... — ничего до TODO |
Каждый агент на финальной стадии пишет раздел «Fact Candidates» — вещи, которые он узнал о проекте, продукте, среде, которые могут быть полезны будущим агентам.
| Артефакт | Кто пишет | Когда |
|---|---|---|
| RF §6 Fact Candidates | Executor | При написании RF |
| REVIEW §5 Fact Candidates | Reviewer | При написании REVIEW |
| RES → Closure | Researcher | При закрытии RES |
Формат:
## Fact Candidates
> Candidates are NOT verified facts. They become facts after `/tfw-knowledge` consolidation.
> Record only if the next agent would make a DIFFERENT DECISION knowing this fact.
>
> Anti-patterns: "project uses git", "code is in Python", "tests exist"
| # | Category | Candidate | Source | Confidence |
|---|----------|-----------|--------|------------|
| 1 | environment | Production DB is on shared instance, not dedicated | User said in chat | High |
| 2 | process | Client expects weekly reports every Monday | Implied from TS constraints | Medium |
| 3 | convention | Team prefers explicit error messages over generic ones | Observed in code review | High |
Категории (domain-agnostic, TFW applies to any field):
| Category | Scope | Examples |
|---|---|---|
environment |
Where the work lives | servers, tools, platforms, classrooms, labs, hosting |
process |
How work gets done | schedules, approvals, reporting cadence, grading rules |
stakeholder |
Who is involved | clients, students, reviewers, partners, regulators |
constraint |
What limits exist | budgets, deadlines, legal, compliance, technical limits |
convention |
Agreed standards | naming, style, format, language, tone |
domain |
Subject matter | business rules, scientific models, curriculum, regulations |
context |
Background knowledge | history, prior decisions, external factors, market conditions |
risk |
Known dangers | fragile dependencies, single points of failure, assumptions |
Categories are open — agents can use custom categories when none fit. The list above is guidance, not exhaustive.
project-root/
├── .user_preferences.md # ← gitignored, personal
Содержимое: язык общения, тон, стиль работы, привычки, timezone, предпочтения инструментов. Записывается один раз, обновляется агентом если замечает изменения.
/tfw-knowledge — отдельный workflow (Dream-like consolidation)RESEARCH decision R5: Separate workflow, NOT tfw-docs extension. Different trigger (periodic vs per-task), different duration (10-20 min vs 2 min), different scope (batch vs single).
Новый workflow /tfw-knowledge с 4 фазами:
Phase 1: Orient — прочитать KNOWLEDGE.md + knowledge/ topic files, понять текущее состояние знаний
Phase 2: Gather — собрать Fact Candidates из всех RF/REVIEW/RES с момента последней консолидации
Phase 3: Consolidate — сверить, дедуплицировать, разрешить противоречия, записать в topic files
Phase 4: Prune — удалить устаревшее, пометить непроверенное, обновить индекс в KNOWLEDGE.md §5
Capabilities:
fact-candidates: processed YYYY-MM-DDknowledge_state.yaml (total, verified, unverified, rejected)tfw-docs остаётся как есть — quick per-task pass (sections 0-4 KNOWLEDGE.md). Получает п.6 в checklist: “Fact Candidates present? They will be processed during next /tfw-knowledge.”
Knowledge Gate живёт отдельно от основного pipeline. Не новый статус для задач, а отдельная сессия с собственным трекингом.
Трекинг: .tfw/knowledge_state.yaml
# State — updated by /tfw-knowledge. Config → see tfw.knowledge in PROJECT_CONFIG.yaml
knowledge:
last_consolidation_seq: 15 # seq of last task when consolidation ran
last_consolidation_date: 2026-04-03
stats:
total_facts: 23
verified: 18
unverified: 5
rejected: 2
candidates_processed: 47
sources_scanned: 12
RESEARCH decision R7: No
pending_candidates— seq-based check sufficient.
Lifecycle (2 статуса, своя сессия):
🔍 SCAN → ✅ CONSOLIDATED
🔍 SCAN — агент сканирует все артефакты с момента last_consolidation_seq, собирает Fact Candidates✅ CONSOLIDATED — пользователь подтвердил, topic files обновлены, last_consolidation_seq сдвинутПравила:
(current_seq - last_consolidation_seq) >= intervaltfw.knowledge.gate_mode: hard (default) / soft / offhard → hard stop: “Knowledge consolidation overdue. Run /tfw-knowledge before proceeding.” Skip requires justificationsoft → reminder only, user decides/tfw-knowledge), 5-10 минутВ plan.md: Phase 0: Knowledge Gate Check (перед Phase 1).
knowledge/ — index + topic filesRESEARCH decision R4: Claude Code uses topic files to offload detail from MEMORY.md index. TFW adopts: KNOWLEDGE.md §5 = compact index,
knowledge/= detail.
Структура:
project-root/
├── KNOWLEDGE.md # index (≤200 строк, configurable)
├── knowledge/ # topic files (project-specific facts)
│ ├── environment.md
│ ├── stakeholders.md
│ └── domain.md
├── .tfw/
│ └── knowledge_state.yaml # state + statistics (infrastructure)
KNOWLEDGE.md §5 (compact index):
## 5. Project Facts
> Index of project knowledge. Details in `knowledge/` topic files.
| Category | Count | Topic File |
|----------|-------|------------|
| environment | 7 facts | [→](knowledge/environment.md) |
| stakeholder | 4 facts | [→](knowledge/stakeholders.md) |
| domain | 12 facts | [→](knowledge/domain.md) |
Topic file format (knowledge/environment.md):
# Knowledge: Environment
| # | Fact | Verified | Source(s) | Added |
|---|------|----------|-----------|-------|
| F1 | Production DB on shared PostgreSQL 16 | ✅ 2x | RF TFW-8, RF TFW-12 | 2026-03-15 |
| F2 | Service lives in Docker Swarm, not K8s | ✅ confirmed | RF SLC-3, RF SLC-7 | 2026-03-20 |
Configurable limits (PROJECT_CONFIG.yaml):
| Parameter | Default | Config key |
|---|---|---|
| KNOWLEDGE.md max lines | 200 | tfw.knowledge.max_index_lines |
| §5 index max lines | 30 | tfw.knowledge.max_index_facts_lines |
| Topic file max facts | 50 | tfw.knowledge.max_facts_per_topic |
| Topic files max count | 8 (soft) | tfw.knowledge.max_topic_files |
| Consolidation interval | 5 | tfw.knowledge.interval |
| Gate mode | hard | tfw.knowledge.gate_mode |
.user_preferences.md template + .gitignore entry в init.md/tfw-knowledge workflow + knowledge infrastructure 🔴.tfw/workflows/knowledge.md — 4-phase process (Orient → Gather → Consolidate → Prune)knowledge/ папку с template topic file.tfw/knowledge_state.yamltfw.knowledge section в PROJECT_CONFIG.yaml (limits + gate_mode)tfw-config — пропагация yaml config changes во все workflows/adapterstfw-user-tune — personal preferences pipeline (.user_preferences.md lifecycle).user_preferences.md template exists, .gitignore guidance in init workflow.tfw/workflows/knowledge.md — 4-phase consolidation workflowknowledge/ folder with topic file template.tfw/knowledge_state.yaml with stats trackingtfw.knowledge section in PROJECT_CONFIG.yaml (limits + gate_mode)При провале:
.user_preferences.md = gitignored, personal, cross-project applicable. Project facts = shared, committed, project-specific.environment, process, stakeholder, не infra, integration, deployment.| Зависимость | Статус |
|---|---|
| RF.md template | ✅ current |
| REVIEW.md template | ✅ current |
| RES.md template | ✅ current |
| docs.md workflow | ✅ current |
| KNOWLEDGE.md template | ✅ current |
| conventions.md | ✅ current |
| glossary.md | ✅ current |
| plan.md | ✅ current (v0.5.5) |
| Риск | Вероятность | Влияние | Mitigation |
|---|---|---|---|
| Fact Candidates = noise (too many trivial facts) | Высокая | Среднее | Quality examples in template + pruning in consolidation |
| DOCS gate friction | Средняя | Высокое | Make it lightweight (scan → propose → approve, <5 min) |
| KNOWLEDGE.md grows unbounded | Средняя | Среднее | Prune phase + size limit (≤30 facts in §5) |
| Blast radius concerns | Knowledge Gate = separate lifecycle, no pipeline changes. Only plan.md gets Phase 0 check | ||
| Contradiction resolution = hard | Низкая | Среднее | Agent flags, user resolves — no auto-resolution |
| *HL — TFW-18: Knowledge Consolidation | 2026-04-03* |