* Implement DescribeTool for listing available MCP tools with annotations. * Add UpsertToolAnnotation and GetToolAnnotations methods for managing tool notes. * Create tool_annotations table for storing tool usage notes.
89 lines
7.6 KiB
Markdown
89 lines
7.6 KiB
Markdown
# AMCS Memory Instructions
|
|
|
|
AMCS (Avalon Memory Crystal Server) is an MCP server for capturing and retrieving thoughts, memory, and project context. It is backed by Postgres with pgvector for semantic search.
|
|
|
|
You have access to an MCP memory server named AMCS.
|
|
|
|
Use AMCS as memory with two scopes:
|
|
- Project memory: preferred when the current work clearly belongs to a known project.
|
|
- Global notebook memory: allowed only when the information is not tied to any specific project.
|
|
|
|
## Scope Selection Rules
|
|
|
|
1. Infer the current project from the repo, current working directory, README, package or app name, and any explicit user instruction.
|
|
2. Call `get_active_project`.
|
|
3. If the active project clearly matches the current work, use it.
|
|
4. If not, call `list_projects` and look for a strong match by name or explicit user intent.
|
|
5. If a strong match exists, call `set_active_project` and use project-scoped memory.
|
|
6. If no strong project match exists, you may use global notebook memory with no project.
|
|
7. If multiple projects plausibly match, ask the user before reading or writing project memory.
|
|
|
|
## Session Startup
|
|
|
|
At the very start of any session with AMCS:
|
|
|
|
1. Call `describe_tools` to get the full list of available tools with their categories and any notes you have previously annotated. Read the notes before using a tool — they contain accumulated gotchas, workflow patterns, and field-ordering requirements you have recorded from prior sessions.
|
|
|
|
## Project Session Startup
|
|
|
|
After setting the active project:
|
|
|
|
1. Call `list_project_skills` to load any saved agent behaviour instructions for the project.
|
|
2. Call `list_project_guardrails` to load any saved agent constraints for the project.
|
|
3. Apply all returned skills and guardrails immediately and for the duration of the session.
|
|
4. Only generate or define new skills and guardrails if none are returned. If you do create new ones, store them with `add_skill` or `add_guardrail` and link them to the project with `add_project_skill` or `add_project_guardrail` so they persist for future sessions.
|
|
|
|
## Project Memory Rules
|
|
|
|
- Use project memory for code decisions, architecture, TODOs, debugging findings, and context specific to the current repo or workstream.
|
|
- Before substantial work, always retrieve context with `get_project_context` or `recall_context` so prior decisions inform your approach.
|
|
- Save durable project facts with `capture_thought` after completing meaningful work.
|
|
- Use `save_file` or `upload_file` for project assets the memory should retain, such as screenshots, PDFs, audio notes, and other documents.
|
|
- If the goal is to retain the artifact itself, store the file directly instead of first reading, transcribing, or summarizing its contents.
|
|
- For binary files or files larger than 10 MB, call `upload_file` with `content_path` (absolute server-side path) first to get an `amcs://files/{id}` URI, then pass that URI to `save_file` as `content_uri` to link it to a thought. This avoids base64 encoding entirely.
|
|
- For small files (≤10 MB) where a server path is not available, use `save_file` or `upload_file` directly with `content_base64`.
|
|
- Link files to a specific memory with `thought_id` when the file belongs to one thought, or to the project with `project` when the file is broader project context.
|
|
- Use `list_files` to browse project files or thought-linked files before asking the user to resend something that may already be stored.
|
|
- Use `load_file` when you need the actual stored file contents back. The result includes both `content_base64` and an embedded MCP binary resource at `amcs://files/{id}` — prefer the embedded resource when your client supports it.
|
|
- You can also read a stored file's raw binary content directly via MCP resources using the URI `amcs://files/{id}` without calling `load_file`.
|
|
- Stored files and attachment metadata must not be sent to the metadata extraction client.
|
|
- Do not attach memory to the wrong project.
|
|
|
|
## Global Notebook Rules
|
|
|
|
- Use global memory only for information that is genuinely cross-project or not project-bound.
|
|
- Examples: user preferences, stable personal workflows, reusable conventions, general background facts, and long-lived non-project notes.
|
|
- If information might later be confused as project-specific, prefer asking or keep it out of memory.
|
|
|
|
## Memory Hygiene
|
|
|
|
- Save only durable, useful information.
|
|
- Do not save secrets, raw logs, or transient noise.
|
|
- Prefer concise summaries.
|
|
- Prefer linking a file to a thought plus a concise thought summary instead of storing opaque binary artifacts without context.
|
|
- Do not read a file just to make it storable; store the file directly and read it only when the file contents are needed for reasoning.
|
|
- Do not base64-encode a file to pass it to `save_file` if an `amcs://files/{id}` URI is already available from a prior `upload_file` or HTTP upload.
|
|
- When saving, choose the narrowest correct scope: project if project-specific, global if not.
|
|
|
|
## Tool Annotations
|
|
|
|
As you learn non-obvious behaviours, gotchas, or workflow patterns for individual tools, persist them with `annotate_tool`:
|
|
|
|
```json
|
|
{ "tool_name": "capture_thought", "notes": "Always pass project explicitly — session state is unreliable in this client." }
|
|
```
|
|
|
|
Notes are returned by `describe_tools` in future sessions. Annotate whenever you discover something worth remembering: a required field combination, a parameter that behaves unexpectedly, or a preferred call sequence. Pass an empty string to clear a note.
|
|
|
|
## Skills and Guardrails
|
|
|
|
- **Skills** are reusable agent behaviour instructions (e.g. output formatting rules, reasoning strategies, workflow conventions).
|
|
- **Guardrails** are agent constraints and safety rules (e.g. never delete without confirmation, do not expose secrets). Each guardrail has a severity: `low`, `medium`, `high`, or `critical`.
|
|
- Use `add_skill` / `add_guardrail` to create new entries, `list_skills` / `list_guardrails` to browse the full library, and `remove_skill` / `remove_guardrail` to delete entries.
|
|
- Use `add_project_skill` / `add_project_guardrail` to attach entries to the current project, and `remove_project_skill` / `remove_project_guardrail` to detach them.
|
|
- Always load project skills and guardrails at session start before generating new ones — see Project Session Startup above.
|
|
|
|
## Short Operational Form
|
|
|
|
At the start of every session, call `describe_tools` to read the full tool list and any accumulated usage notes. Use AMCS memory in project scope when the current work matches a known project; if no clear project matches, global notebook memory is allowed for non-project-specific information. At the start of every project session call `list_project_skills` and `list_project_guardrails` and apply what is returned; only create new skills or guardrails if none exist. If your MCP client does not preserve sessions across calls, pass `project` explicitly instead of relying on `set_active_project`. Store durable notes with `capture_thought`. For binary files or files larger than 10 MB, call `upload_file` with `content_path` to stage the file and get an `amcs://files/{id}` URI, then pass that URI to `save_file` as `content_uri` to link it to a thought. For small files, use `save_file` or `upload_file` with `content_base64` directly. Browse stored files with `list_files`, and load them with `load_file` only when their contents are needed. Stored files can also be read as raw binary via MCP resources at `amcs://files/{id}`. Never store project-specific memory globally when a matching project exists, and never store memory in the wrong project. If project matching is ambiguous, ask the user. Whenever you discover a non-obvious tool behaviour, gotcha, or workflow pattern, record it with `annotate_tool` so future sessions benefit.
|