context-store

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context Store Skill

Context Store Skill

What & When

是什么与何时使用

What: Commands for uploading, downloading, querying and deleting documents with metadata and tags through the Context Store server. Also linking to one another via relations.
When to use:
  • Store important documents for retrieval in future sessions
  • Build a knowledge base of project documentation
  • Share architecture, API specs, or design documents across different work sessions
  • Query documents by tags to find relevant information
Key Benefits:
  • Cross-session persistence
  • Tag-based organization with AND logic
  • Simple JSON output

是什么:通过Context Store服务器进行文档上传、下载、查询、删除(附带元数据和标签)以及建立文档间关联的命令集。
适用场景
  • 存储重要文档以便在未来会话中检索
  • 构建项目文档知识库
  • 在不同工作会话间共享架构文档、API规范或设计文档
  • 通过标签查询文档以找到相关信息
核心优势
  • 跨会话持久化存储
  • 基于AND逻辑的标签分类
  • 简洁的JSON输出

Quick Reference

快速参考

CRITICAL: Always use absolute paths - NEVER use
cd
:
重要提示:请始终使用绝对路径——切勿使用
cd
命令:

doc-push
- Upload Documents

doc-push
- 上传文档

bash
uv run --script <skill-root>/commands/doc-push <file> [--tags TEXT] [--description TEXT]
bash
uv run --script <skill-root>/commands/doc-push <file> [--tags TEXT] [--description TEXT]

Example: uv run --script <skill-root>/commands/doc-push specs.md --tags "api,v2"

Example: uv run --script <skill-root>/commands/doc-push specs.md --tags "api,v2"

**Use when**: Store a document for future reference.
**适用场景**:存储文档以供后续查阅。

doc-query
- Search by Tags/Name

doc-query
- 按标签/名称搜索

bash
uv run --script <skill-root>/commands/doc-query [--tags TEXT] [--name TEXT] [--include-relations]
bash
uv run --script <skill-root>/commands/doc-query [--tags TEXT] [--name TEXT] [--include-relations]

Example: uv run --script <skill-root>/commands/doc-query --tags "api,v2"

Example: uv run --script <skill-root>/commands/doc-query --tags "api,v2"

With relations: uv run --script <skill-root>/commands/doc-query --tags "api" --include-relations

With relations: uv run --script <skill-root>/commands/doc-query --tags "api" --include-relations

**Use when**: Find documents by tags (AND logic) or name patterns.
**Option**: `--include-relations` adds relations to each document in response.
**适用场景**:通过标签(AND逻辑)或名称模式查找文档。
**可选参数**:`--include-relations`会在结果中添加文档间的关联信息。

doc-search
- Semantic Search

doc-search
- 语义搜索

bash
uv run --script <skill-root>/commands/doc-search "<query>" [--limit INT] [--include-relations]
bash
uv run --script <skill-root>/commands/doc-search "<query>" [--limit INT] [--include-relations]

Example: uv run --script <skill-root>/commands/doc-search "how to configure authentication"

Example: uv run --script <skill-root>/commands/doc-search "how to configure authentication"

With relations: uv run --script <skill-root>/commands/doc-search "auth" --include-relations

With relations: uv run --script <skill-root>/commands/doc-search "auth" --include-relations

**Use when**: Find documents by meaning using natural language queries.
**Note**: Requires semantic search enabled on server. Returns section offsets for partial reads.
**Option**: `--include-relations` adds relations to each result.
**适用场景**:通过自然语言查询按文档语义查找相关内容。
**注意**:需要服务器启用语义搜索功能。返回结果包含用于部分读取的段落偏移量。
**可选参数**:`--include-relations`会在结果中添加文档间的关联信息。

doc-info
- Get Document Metadata & Relations

doc-info
- 获取文档元数据与关联信息

bash
uv run --script <skill-root>/commands/doc-info <document-id>
bash
uv run --script <skill-root>/commands/doc-info <document-id>

Example: uv run --script <skill-root>/commands/doc-info doc_abc123

Example: uv run --script <skill-root>/commands/doc-info doc_abc123

**Use when**: View metadata and relations for a specific document without downloading it.
**Output**: Includes `relations` field with parent/child/related document links.
**适用场景**:无需下载文档即可查看特定文档的元数据和关联信息。
**输出**:包含`relations`字段,展示父文档/子文档/相关文档的链接。

doc-read
- Read Text Documents

doc-read
- 读取文本文档

bash
uv run --script <skill-root>/commands/doc-read <document-id> [--offset INT] [--limit INT]
bash
uv run --script <skill-root>/commands/doc-read <document-id> [--offset INT] [--limit INT]

Example: uv run --script <skill-root>/commands/doc-read doc_abc123

Example: uv run --script <skill-root>/commands/doc-read doc_abc123

Partial: uv run --script <skill-root>/commands/doc-read doc_abc123 --offset 2000 --limit 1000

Partial: uv run --script <skill-root>/commands/doc-read doc_abc123 --offset 2000 --limit 1000

**Use when**: Output text document content directly to stdout (text files only).
**Partial reads**: Use `--offset` and `--limit` to retrieve specific sections (useful with semantic search results).
**适用场景**:将文本文档内容直接输出到标准输出(仅支持文本文件)。
**部分读取**:使用`--offset`和`--limit`参数检索特定段落(配合语义搜索结果使用非常实用)。

doc-pull
- Download Documents

doc-pull
- 下载文档

bash
uv run --script <skill-root>/commands/doc-pull <document-id> [-o PATH]
bash
uv run --script <skill-root>/commands/doc-pull <document-id> [-o PATH]

Example: uv run --script <skill-root>/commands/doc-pull doc_abc123 -o specs.md

Example: uv run --script <skill-root>/commands/doc-pull doc_abc123 -o specs.md

**Use when**: Retrieve a document by its ID.
**适用场景**:通过文档ID检索并下载文档。

doc-delete
- Remove Documents

doc-delete
- 删除文档

bash
uv run --script <skill-root>/commands/doc-delete <document-id>
bash
uv run --script <skill-root>/commands/doc-delete <document-id>

Example: uv run --script <skill-root>/commands/doc-delete doc_abc123

Example: uv run --script <skill-root>/commands/doc-delete doc_abc123

**Use when**: Permanently remove a document.
**适用场景**:永久删除文档。

doc-link
- Manage Document Relations

doc-link
- 管理文档关联

bash
uv run --script <skill-root>/commands/doc-link --types                     # List relation types
uv run --script <skill-root>/commands/doc-link --create <from> <to> [opts] # Create relation
uv run --script <skill-root>/commands/doc-link --update <id> --note "..."  # Update note
uv run --script <skill-root>/commands/doc-link --remove <id>               # Remove relation
Use when: Link documents together in parent-child or peer relationships. Options for --create:
  • --type
    - Required:
    parent-child
    (hierarchical) or
    related
    (peer)
  • --from-to-note
    - Note on edge from source to target (source's note about target)
  • --to-from-note
    - Note on edge from target to source (target's note about source)

bash
uv run --script <skill-root>/commands/doc-link --types                     # List relation types
uv run --script <skill-root>/commands/doc-link --create <from> <to> [opts] # Create relation
uv run --script <skill-root>/commands/doc-link --update <id> --note "..."  # Update note
uv run --script <skill-root>/commands/doc-link --remove <id>               # Remove relation
适用场景:建立文档间的父子关系或同级关系。 --create参数选项
  • --type
    - 必填:
    parent-child
    (层级归属)或
    related
    (同级关联)
  • --from-to-note
    - 源文档到目标文档的关联备注(源文档对目标文档的说明)
  • --to-from-note
    - 目标文档到源文档的关联备注(目标文档对源文档的说明)

Typical Workflows

典型工作流

Store and Retrieve

存储与检索

bash
undefined
bash
undefined

Upload with tags

Upload with tags

uv run --script <skill-root>/commands/doc-push specs.md --tags "api,v2"
uv run --script <skill-root>/commands/doc-push specs.md --tags "api,v2"

Find it later

Find it later

uv run --script <skill-root>/commands/doc-query --tags "api,v2"
uv run --script <skill-root>/commands/doc-query --tags "api,v2"

Download it

Download it

uv run --script <skill-root>/commands/doc-pull doc_abc123
undefined
uv run --script <skill-root>/commands/doc-pull doc_abc123
undefined

Build Knowledge Base

构建知识库

bash
undefined
bash
undefined

Upload multiple documents with consistent tags

Upload multiple documents with consistent tags

uv run --script <skill-root>/commands/doc-push architecture.md --tags "design,mvp" uv run --script <skill-root>/commands/doc-push api-spec.md --tags "api,mvp"
uv run --script <skill-root>/commands/doc-push architecture.md --tags "design,mvp" uv run --script <skill-root>/commands/doc-push api-spec.md --tags "api,mvp"

Query by project phase

Query by project phase

uv run --script <skill-root>/commands/doc-query --tags "mvp"
undefined
uv run --script <skill-root>/commands/doc-query --tags "mvp"
undefined

Semantic Search + Partial Read

语义搜索+部分读取

bash
undefined
bash
undefined

Search by meaning

Search by meaning

uv run --script <skill-root>/commands/doc-search "how to authenticate users"
uv run --script <skill-root>/commands/doc-search "how to authenticate users"

Returns: {"results": [{"document_id": "doc_abc", "sections": [{"offset": 2000, "limit": 1000}]}]}

Returns: {"results": [{"document_id": "doc_abc", "sections": [{"offset": 2000, "limit": 1000}]}]}

Read only the relevant section

Read only the relevant section

uv run --script <skill-root>/commands/doc-read doc_abc --offset 2000 --limit 1000
undefined
uv run --script <skill-root>/commands/doc-read doc_abc --offset 2000 --limit 1000
undefined

Link Related Documents

关联相关文档

bash
undefined
bash
undefined

Get relation types

Get relation types

uv run --script <skill-root>/commands/doc-link --types
uv run --script <skill-root>/commands/doc-link --types

Create a sequential relationship

Create a sequential relationship

uv run --script <skill-root>/commands/doc-link --create doc_design doc_implementation --type predecessor-successor --from-to-note "Design doc" --to-from-note "Implementation plan"
uv run --script <skill-root>/commands/doc-link --create doc_design doc_implementation --type predecessor-successor --from-to-note "Design doc" --to-from-note "Implementation plan"

Create hierarchical relationship (parent owns children)

Create hierarchical relationship (parent owns children)

uv run --script <skill-root>/commands/doc-link --create doc_architecture doc_api --type parent-child --from-to-note "API spec"
uv run --script <skill-root>/commands/doc-link --create doc_architecture doc_api --type parent-child --from-to-note "API spec"

Create peer relationship

Create peer relationship

uv run --script <skill-root>/commands/doc-link --create doc_api doc_models --type related --from-to-note "Data models"
uv run --script <skill-root>/commands/doc-link --create doc_api doc_models --type related --from-to-note "Data models"

View document with its relations

View document with its relations

uv run --script <skill-root>/commands/doc-info doc_architecture

---
uv run --script <skill-root>/commands/doc-info doc_architecture

---

Key Concepts

核心概念

Tag AND Logic

标签AND逻辑

IMPORTANT: Multiple tags means ALL must match:
  • --tags "python,api"
    → Document must have BOTH tags
  • --tags "v2,design,spec"
    → Document must have ALL THREE tags
重要提示:多个标签表示必须同时匹配所有标签:
  • --tags "python,api"
    → 文档必须同时包含这两个标签
  • --tags "v2,design,spec"
    → 文档必须同时包含这三个标签

Output Format

输出格式

All commands output JSON. Save document IDs from upload for later retrieval/deletion.
所有命令均输出JSON格式。请保存上传文档时返回的文档ID,以便后续检索或删除。

Document Relations

文档关联

Relation Types:
  • parent-child: Hierarchical ownership. Deleting parent cascades to children.
  • related: Peer relationship. No cascade delete.
Bidirectional: Relations are stored from both perspectives. Creating a parent-child link adds:
  • parent
    relation on the parent document
  • child
    relation on the child document

关联类型
  • parent-child:层级归属关系。删除父文档会同时删除其子文档。
  • related:同级关联关系。删除文档不会影响关联的同级文档。
双向存储:关联关系会从两个方向存储。创建父子关联会同时添加:
  • 父文档中的
    parent
    关联
  • 子文档中的
    child
    关联

Notes for AI Assistants

AI助手注意事项

  1. Tag AND logic - Multiple tags = ALL must match
  2. Save document IDs - From upload output for future operations
  3. Check server running - Handle connection errors gracefully
  4. Parse JSON output - All commands return JSON
  5. Tags are lowercase - Use consistent tag naming (
    python
    not
    Python
    )
  6. Relations in doc-info - Use
    doc-info
    to see document relations without a separate call
  7. Relation IDs - Save relation IDs from create output for update/remove operations
  8. Cascade delete - Deleting a parent document also deletes its children

  1. 标签AND逻辑 - 多个标签表示必须同时匹配所有标签
  2. 保存文档ID - 保存上传输出中的文档ID以便后续操作
  3. 检查服务器状态 - 优雅处理连接错误
  4. 解析JSON输出 - 所有命令均返回JSON格式
  5. 标签小写 - 使用统一的小写标签命名(如
    python
    而非
    Python
  6. 通过doc-info查看关联 - 使用
    doc-info
    命令查看文档关联,无需单独调用其他命令
  7. 保存关联ID - 保存创建关联时输出的关联ID以便后续更新或删除
  8. 级联删除 - 删除父文档会同时删除其子文档

Quick Decision Tree

快速决策树

Store document?
doc-push <file> --tags "tag1,tag2"
Find by tags?
doc-query --tags "tag1,tag2"
(AND logic, add
--include-relations
for links)
Find by meaning?
doc-search "your question"
(add
--include-relations
for links)
Check metadata?
doc-info <doc-id>
(metadata + relations)
Read text file?
doc-read <doc-id>
(text files to stdout)
Read section?
doc-read <doc-id> --offset 2000 --limit 1000
(partial read)
Download document?
doc-pull <doc-id>
(ID from query)
Remove document?
doc-delete <doc-id>
(permanent)
List all?
doc-query
(no args)
Link documents?
doc-link --create <from> <to> --type parent-child
List relation types?
doc-link --types
Update link note?
doc-link --update <id> --note "text"
Remove link?
doc-link --remove <id>
(removes both directions)

需要存储文档?
doc-push <file> --tags "tag1,tag2"
需要按标签查找?
doc-query --tags "tag1,tag2"
(AND逻辑,添加
--include-relations
查看关联)
需要按语义查找?
doc-search "你的问题"
(添加
--include-relations
查看关联)
需要查看元数据?
doc-info <doc-id>
(包含元数据和关联信息)
需要读取文本文件?
doc-read <doc-id>
(将文本文件输出到标准输出)
需要读取特定段落?
doc-read <doc-id> --offset 2000 --limit 1000
(部分读取)
需要下载文档?
doc-pull <doc-id>
(文档ID来自查询结果)
需要删除文档?
doc-delete <doc-id>
(永久删除)
需要列出所有文档?
doc-query
(不带任何参数)
需要关联文档?
doc-link --create <from> <to> --type parent-child
需要查看关联类型?
doc-link --types
需要更新关联备注?
doc-link --update <id> --note "文本内容"
需要删除关联?
doc-link --remove <id>
(同时删除双向关联)

Additional Resources

额外资源

  • Detailed Command Reference: See
    references/COMMANDS.md
  • Configuration Options: See
    references/CONFIGURATION.md
  • Error Handling: See
    references/TROUBLESHOOTING.md
  • 详细命令参考:查看
    references/COMMANDS.md
  • 配置选项:查看
    references/CONFIGURATION.md
  • 错误处理:查看
    references/TROUBLESHOOTING.md