AI Agent Guide
Guidance for agents working with Knowns projects.
AI Agent Guide
This guide explains how to use Knowns effectively with AI assistants.
Core idea
AI works better when it does not have to guess project context.
Knowns gives AI a structured way to access:
- tasks
- docs
- memory
- references
- validation
- search and retrieval
Recommended usage pattern
1. Call initial first
The AI should call the initial MCP tool at session start. It returns project state, code intelligence rules, workflow guidance, and available tools — everything needed to begin work.
2. Use help for tool details
When the AI needs to use an unfamiliar tool or action, call help("tool.action") or help("tool.*") for on-demand documentation.
3. Use tasks as execution targets
Instead of giving a vague prompt, point the AI at a task with acceptance criteria.
3. Use docs for durable explanation
Architecture, patterns, and operational guidance should live in docs rather than only in chat.
4. Use memory for durable decisions
Store reusable decisions, conventions, and failures in memory so they can be recalled later.
5. Validate before calling work complete
Validation should be part of the normal workflow.
Research source order
When an AI needs to understand a codebase or upstream behavior, it should search in this order:
- Knowns
searchandretrievefor local project context. - Knowns
codetools for code structure, symbols, definitions, references, diagnostics, and edits. - External MCP providers such as Context7/library docs, GitHub/source MCP, or official docs MCP when current upstream facts matter.
- General web search when specialized MCP providers are unavailable, insufficient, or explicitly requested.
External research should be cited and reconciled with local source-of-truth files instead of overriding them silently.
MCP vs CLI
Prefer MCP when:
- the AI runtime supports it
- you want structured tool calls
- you want less shell parsing and less prompt copy-paste
Prefer CLI when:
- MCP is unavailable
- you are scripting outside an MCP-aware runtime
- you want to inspect output manually in a terminal
Example workflow
- AI calls
initial(gets project state + rules + workflow guidance) - AI reads the target task
- AI follows any
@doc/...or@task-...references - AI calls
help("tool.action")if unsure how to use a tool - AI uses
codetools for code discovery and editing (not Read/Grep/Edit) - AI implements changes
- AI runs validation or tests
Related
Làm việc với AI
Cách dùng Knowns hiệu quả khi làm việc cùng AI assistants.
Ý chính
AI làm việc tốt hơn nhiều khi không phải tự đoán context.
Knowns cho AI truy cập có cấu trúc vào:
- task
- doc
- memory
- reference
- validation
- search và retrieval
Cách dùng
1. Gọi initial trước
AI nên gọi tool initial khi bắt đầu session. Nó trả về project state, code intelligence rules, workflow guidance, và danh sách tools — đủ để bắt đầu làm việc.
2. Dùng help khi cần chi tiết
Khi AI cần dùng tool/action chưa quen, gọi help("tool.action") hoặc help("tool.*") để xem hướng dẫn on-demand.
3. Dùng task làm mục tiêu
Thay vì prompt mơ hồ, trỏ AI vào task có acceptance criteria rõ ràng.
3. Dùng doc cho context lâu dài
Architecture, pattern, hướng dẫn vận hành nên nằm trong doc, không chỉ tồn tại trong chat.
4. Dùng memory cho decision cần nhớ
Lưu decision, convention, failure vào memory để gọi lại sau.
5. Validate trước khi coi là xong
Validation nên là phần bình thường của workflow.
Thứ tự nguồn khi research
Khi AI cần hiểu codebase hoặc upstream behavior, nên search theo thứ tự:
- Knowns
searchvàretrievecho local project context. - Knowns
codetools cho code structure, symbols, definitions, references, diagnostics, và edits. - External MCP providers như Context7/library docs, GitHub/source MCP, hoặc official docs MCP khi cần current upstream facts.
- General web search khi specialized MCP providers không có, không đủ, hoặc user yêu cầu rõ.
External research nên có citation và phải reconcile với local source-of-truth files, không silently override chúng.
MCP hay CLI?
Ưu tiên MCP khi:
- AI runtime hỗ trợ MCP
- muốn structured tool calls
- muốn giảm parse shell output
Ưu tiên CLI khi:
- MCP không có
- đang script ngoài MCP-aware runtime
- muốn xem output trực tiếp trong terminal
Ví dụ workflow
- AI gọi
initial(nhận project state + rules + workflow guidance) - AI đọc target task
- AI follow
@doc/...hoặc@task-...references - AI gọi
help("tool.action")nếu chưa rõ cách dùng tool - AI dùng
codetools cho code discovery và editing (không dùng Read/Grep/Edit) - AI implement
- AI chạy validation hoặc test