Le Duy Khuong

Chuỗi: claude-code-20-p3 · Phần 1

Năng suất & công cụ dev

Học từ session — continuous learning (instincts)

Khái niệm instinct / pattern học từ lịch sử; export/import, evolve.

2026-03-146 phút đọcVI

Phần 1 của 520% hoàn thành

Học từ session — continuous learning (instincts)

English title: Learn From Sessions — Continuous Learning (Instincts)

Bài 11 trong chuỗi 20 bài về Claude Code. Session qua đi nhưng pattern có thể được ghi nhận và tái dùng: instinct = pattern/sở thích học từ lịch sử (vd. "luôn dùng async/await", "tránh var"). Bài này giải thích instinct là gì, export/import và evolve, và tích hợp với workflow.


Mở đầu: Session qua đi — pattern được ghi nhận và tái dùng

Bạn nhiều lần nhắc Claude "dùng async/await thay vì .then". Thay vì mỗi session nhắc lại, hệ thống có thể extract pattern đó thành instinct và lưu. Lần sau instinct được load cùng rules → Claude mặc định follow mà không cần bạn nhắc. Instinct khác rule: rule = convention bắt buộc (team); instinct = preference học từ lịch sử (cá nhân/project), có thể review và evolve.


1. Đi sâu: Instinct là gì và tại sao cần

Tại sao quan trọng: Pattern lặp lại (naming, style, cách xử lý lỗi) nếu được ghi nhận thì giảm nhắc lại và tăng consistency. Instinct = cơ chế "học từ session" — extract → user approve → lưu.

Hiểu sai: "Instinct = rule." Rule luôn áp dụng, thường do team định nghĩa. Instinct có thể cá nhân, project-specific; thứ tự ưu tiên thường rule > instinct > default.

Bản chất: Instinct = pattern/sở thích (text) được extract từ session (cuối session hoặc on-demand), user confirm, lưu vào file/registry. Khi load context, instinct được inject (cùng rule). Review định kỳ để bỏ instinct nhiễu hoặc quá cụ thể.


2. Khái niệm

  • Instinct: Pattern học từ lịch sử; format lưu (markdown/YAML). Nguồn: user confirm sau extract hoặc import.
  • Export/import: Export instincts ra file (share team, backup). Import vào project/global; merge (append) hoặc replace.
  • Evolve: Cập nhật instinct khi có feedback; gộp instinct tương tự thành skill (một số workflow hỗ trợ).
  • Ưu tiên: Rule > instinct > default. Giới hạn số instinct active để context không nặng.

3. Workflow: Extract → approve → lưu; export/import

  1. Cuối session hoặc on-demand: extract pattern từ transcript (vd. "user nhiều lần nói dùng async/await").
  2. User approve hoặc chỉnh; lưu vào instinct store (file hoặc registry).
  3. Session sau: load instinct cùng rule. Instinct cho preference; rule cho convention bắt buộc.
  4. Export: ra file readable (markdown/YAML). Import: merge hoặc replace. Đồng đội import vào project mới để onboard.

4. Ứng dụng trong AI-centric engineering

Tích lũy pattern cá nhân/project mà không biến tất cả thành rule cứng. Review instinct định kỳ; evolve (gộp, xóa) để giữ chất lượng. Bài 12 nói verification — checkpoint và verify — làm xong bước thì đóng dấu, verify trước khi sang bước tiếp.


Bài tiếp: Verification — checkpoint và verify (bài 12).

LDK

Le Duy Khuong

AI Transformation & Digital Strategy. Writing about agentic systems, engineering leadership, and building in public.