Handoff — Opus New Session: Vector Hygiene Design 20 Next
Handoff — Opus New Session: Vector Hygiene Design 20 Next
Date: 2026-05-05 Author: GPT-5.5 Thinking / Incomex Hội đồng AI Purpose: Copy nguyên văn cho Opus phiên mới để tiếp tục xử lý vector/search hygiene liền mạch, không search lung tung trong lúc vector đang bị nhiễu.
0. One-line status
Agent vector hygiene report đã PASS. Opus đã tạo design pack 20. Nhiệm vụ đầu phiên mới: đọc design pack 20 + các review liên quan, rà soát, rồi soạn prompt read-only cho 20A/20B-P0. Không delete, không deindex, không patch DOT.
1. Vì sao đang xử lý vector/search trước
Vừa rồi hệ thống không tìm ra đúng các cơ chế khai sinh đã có sẵn. Nguyên nhân chính không phải vì cơ chế chưa tồn tại, mà vì retrieval/search bị nhiễu bởi context-pack snapshots và vì KB/vector chưa có governance phân tầng.
User chốt rõ:
- phải xử lý vụ vector cho dứt điểm;
- mục tiêu là hệ thống ổn định dài hạn, search chính xác;
- lỗi không tìm ra tài liệu đã có không được lặp lại;
- không sáng tạo bừa, học chuẩn ngành;
- không tiếp tục Pack 2C/IU khi search vẫn nhiễu.
2. Evidence đã có — không cần điều tra lại từ đầu
Agent report:
knowledge/dev/laws/dieu44-trien-khai/reports/inv-search-vector-hygiene-context-pack-report.md
Key evidence:
- 1.174 docs context-pack = 37.5% KB.
- Ước >60% vector pool là context-pack chunks.
- Search pollution proven:
- query
description_policy structured_exempt= 100% context-pack pollution. - query Đ43 lifecycle = 80% context-pack.
- query
- Metadata filterable về mặt payload:
metadata.source = dieu43_context_pack_publish- path prefix
context-pack/ - tags
context-pack,build.
- Đ43 chưa có TTL/retention/deindex policy.
- DOT context-pack build đang accumulate
context-pack/<build_id>/thay vì overwrite-in-place như README. - 9 build gần nhất chỉ có 1 file, pipeline degradation riêng.
VRC report cũ:
knowledge/dev/laws/dieu38-trien-khai/reports/vector-reality-check-agent-data-qdrant-2026-05-02.md
Key evidence:
- Agent Data search hiện filter được
tags/statusonly. - Không có exposed
source/path excludefilter. - Dedup chỉ theo
document_id. - Payload có metadata đủ để filter nếu code/API hỗ trợ, nhưng hiện API chưa chắc hỗ trợ.
3. Review GPT quan trọng cần đọc
knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-vector-hygiene-report-and-next-directive-2026-05-05.mdknowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-opus-vector-filter-feasibility-objection-2026-05-05.md
Điểm chính:
- Đừng assume 20A filter khả thi.
- Vì search API có thể không hỗ trợ source/path exclude, 20A phải là feasibility gate.
- Nếu 20A không khả thi nhanh, 20B lifecycle/delete-old trở thành primary fix.
- Không bulk delete trước khi có dry-run, guard, retention, rollback.
4. Design pack 20 hiện tại
Path:
knowledge/dev/laws/dieu44-trien-khai/design/20-search-vector-hygiene-stage1-stage2-execution-pack.md
Nội dung 3 gates:
20A — Search Filter Feasibility Gate
Mục tiêu:
- inspect search API/code;
- xác nhận filter hiện có;
- xem có thể thêm
exclude_source/exclude_prefixkhông; - nếu không khả thi thì đóng 20A và chuyển 20B thành primary.
20B — Context-Pack Lifecycle + Delete-Old
Mục tiêu:
- chặn phát sinh ô nhiễm mới;
- dọn 1.174 bản cũ một cách có guard;
- giữ latest hoặc ngừng upload KB;
- FS retention 7 ngày;
- PG manifest/checksum làm audit;
- dry-run delete list + rollback story.
20C — KB Governance Framework
Mục tiêu dài hạn:
- tiers T0/T1/T2/T3;
- TTL/retention;
- upload metadata;
- quota alerts;
- search regression suite;
- phụ lục Đ43.
5. GPT quick review of design pack 20
Design pack 20 đúng hướng, nhưng phiên mới cần làm tiếp theo đúng gate:
- Không nhảy vào execute/delete.
- Soạn prompt Agent read-only cho 20A + 20B-P0 inspection.
- Agent report xong mới quyết:
- 20A filter patch có khả thi không;
- nếu không, 20B cleanup/lifecycle đi trước.
6. Nhiệm vụ đầu tiên của Opus phiên mới
6.1 Đọc đúng file, không search rộng
Đọc theo thứ tự:
knowledge/dev/laws/dieu44-trien-khai/design/20-search-vector-hygiene-stage1-stage2-execution-pack.mdknowledge/dev/laws/dieu44-trien-khai/reports/inv-search-vector-hygiene-context-pack-report.mdknowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-vector-hygiene-report-and-next-directive-2026-05-05.mdknowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-opus-vector-filter-feasibility-objection-2026-05-05.mdknowledge/dev/laws/dieu38-trien-khai/reports/vector-reality-check-agent-data-qdrant-2026-05-02.md— chỉ phần search filter behavior nếu cần.
6.2 Tạo prompt read-only
Tạo prompt:
knowledge/dev/laws/dieu44-trien-khai/prompts/20a-20b-p0-search-vector-hygiene-inspection-prompt.md
Mục tiêu prompt:
- inspect 20A feasibility;
- inspect 20B lifecycle prerequisites;
- không mutate.
7. Prompt 20A/20B-P0 phải hỏi gì
20A — Search API feasibility
Agent phải inspect read-only:
- Agent Data search endpoint code;
- vector_store search code;
- current API params;
- whether current filters support tags/status only;
- whether payload source/path metadata is accessible in code path;
- estimate whether adding
exclude_sourceorexclude_prefixis small patch or larger refactor; - exact files/functions to patch if feasible;
- regression tests needed.
Suggested read-only commands/queries from VRC evidence:
# inside incomex-agent-data container
nl -ba /app/agent_data/vector_store.py | sed -n '240,330p'
nl -ba /app/agent_data/server.py | sed -n '220,270p'
nl -ba /app/agent_data/server.py | sed -n '825,930p'
grep -RIn "filter_tags\|filter_status\|tenant_id\|metadata.source\|document_id\|search(" /app/agent_data --include='*.py'
Agent must answer:
- 20A feasible as small patch? yes/no/unclear.
- If yes, patch points and risk.
- If no, why not.
20B-P0 — Lifecycle prerequisites
Agent phải inspect read-only:
- DOT build script upload/publish logic:
cat /opt/incomex/dot/bin/dot-context-pack-build
# or exact path discovered from KB/report if different
grep -nEi 'upload|createDocument|deleteDocument|context-pack|build_id|current|staging|manifest|README|overwrite' /opt/incomex/dot/bin/dot-context-pack-build
- Filesystem retention reality:
ls -la /opt/incomex/context-pack/ || true
find /opt/incomex/context-pack/ -maxdepth 3 -type f | head -100 || true
du -sh /opt/incomex/context-pack/ || true
find /opt/incomex/context-pack/ -maxdepth 2 -type d | tail -50 || true
- Cron/retention:
crontab -l 2>/dev/null | grep -Ei 'context|pack|cleanup|retention' || true
grep -RInE 'context-pack.*(rm|delete|cleanup|retention|find .*mtime)' /opt/incomex 2>/dev/null | head -100
- PG manifest/checksum:
SELECT table_name
FROM information_schema.tables
WHERE table_name IN ('context_pack_manifest','context_pack_requests','context_pack_sections')
ORDER BY table_name;
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name IN ('context_pack_manifest','context_pack_requests','context_pack_sections')
ORDER BY table_name, ordinal_position;
SELECT count(*) FROM context_pack_manifest;
SELECT count(*) FROM context_pack_requests;
SELECT * FROM v_context_pack_latest LIMIT 5;
Use schema-first guard: if table/view absent, report absence, do not fail.
- KB delete dry-run feasibility:
- Can Agent Data list documents by prefix
context-pack/? - Can it identify latest complete build vs partial latest?
- Can it generate delete list excluding latest complete build?
- Can it verify deleted docs would be recoverable from FS/manifest?
No delete.
- Search regression baseline:
Rerun 7 queries from report if feasible, record current top results.
8. Expected report path
knowledge/dev/laws/dieu44-trien-khai/reports/20a-20b-p0-search-vector-hygiene-inspection-report.md
Report must answer:
- 20A feasible small patch? yes/no/unclear.
- Search filter current exact code evidence.
- 20B lifecycle prerequisites present? FS retention, PG manifest, latest pointer.
- Current DOT build behavior: accumulate/overwrite/delete?
- Delete-old dry-run feasible? yes/no.
- Latest build vs latest complete build.
- Recovery/rollback basis exists? yes/no.
- Recommended next: 20A patch first, or 20B lifecycle/delete-old first.
9. Hard boundaries for Agent prompt
- read-only only;
- no code patch;
- no deleteDocument;
- no deindex;
- no vector config mutation;
- no DOT mutation;
- no Đ43 mutation;
- no filesystem cleanup;
- no service restart;
- no Pack 2C/IU.
10. If Opus wants to patch design pack 20 first
Allowed small patch:
- Update design pack 20 to say next step is combined 20A/20B-P0 read-only prompt.
- Do not turn it into execution.
11. What not to do
Do not create a cleanup execution prompt yet. Do not create a DOT patch prompt yet. Do not write a delete list as final action. Do not ask User whether to proceed with inspection; this is already the next step.
12. Nôm na
Hệ thống đang có hai hướng chữa:
- Lắp bộ lọc vào công cụ tìm kiếm để bỏ qua photocopy.
- Nếu không lắp nhanh được, dọn photocopy cũ khỏi kệ chính và chỉ giữ bản mới/kho lạnh.
Phiên mới phải cử người kiểm:
- công cụ tìm kiếm có lắp được bộ lọc không;
- kho lạnh có đủ giữ bản cũ không;
- danh sách photocopy cũ có lập được an toàn không.
Chưa dọn gì cả.
End of handoff. Copy to Opus new session.