ctxlayer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context Layer

Context Layer

ctx CLI commands

ctx CLI 命令

The
ctx
CLI manages domains and tasks. Available commands:
  • ctx
    -- Show help and available commands
  • ctx new [name]
    -- Create a new task (single entry point; initializes workspace if needed, prompts to create/select domain if missing, and may prompt "use current domain?")
  • ctx import
    -- Import a task from any domain as a local symlink (works on uninitialized workspaces; sets active when config is empty or missing)
  • ctx git [args...]
    -- Run git in the current task directory
  • ctx drop task [name]
    -- Remove a task symlink (with optional task name)
  • ctx drop domain [name]
    -- Remove a domain directory from local
    .ctxlayer/
    (optional domain name)
  • ctx delete task
    -- Delete a task from the context store and remove its symlink
  • ctx delete domain
    -- Delete a domain from the context store and remove its local directory
  • ctx status
    -- Show the current active domain and task
  • ctx set
    -- Set active domain and task (prompts to select)
Git operations on the context layer: When the user requests any git operations (e.g., status, add, commit, push, pull) on the context layer or task context, perform them via
ctx git <args>
rather than running
git
directly.
Configuration lives at
.ctxlayer/config.yaml
in the current working directory with two fields:
yaml
active-domain: <domain-name>
active-task: <task-name>
Domains are stored globally at
~/.agents/ctxlayer/domains/
. Each domain contains task folders, and each task folder has
docs/
and
data/
subdirectories.
ctx
CLI用于管理域和任务。可用命令如下:
  • ctx
    -- 显示帮助信息和可用命令
  • ctx new [name]
    -- 创建新任务(单一入口点;如需则初始化工作区,若缺少域则提示创建/选择域,可能会提示“使用当前域?”)
  • ctx import
    -- 从任意域导入任务作为本地符号链接(可在未初始化的工作区使用;当配置为空或缺失时设置为活跃任务)
  • ctx git [args...]
    -- 在当前任务目录中运行git命令
  • ctx drop task [name]
    -- 移除任务符号链接(可指定任务名称)
  • ctx drop domain [name]
    -- 从本地
    .ctxlayer/
    目录中移除域文件夹(可指定域名称)
  • ctx delete task
    -- 从上下文存储中删除任务并移除其符号链接
  • ctx delete domain
    -- 从上下文存储中删除域并移除其本地目录
  • ctx status
    -- 显示当前活跃的域和任务
  • ctx set
    -- 设置活跃域和任务(提示进行选择)
Context Layer上的Git操作: 当用户要求在Context Layer或任务上下文中执行任何Git操作(如status、add、commit、push、pull)时,请通过
ctx git <args>
执行,而非直接运行
git
命令。
配置文件位于当前工作目录的
.ctxlayer/config.yaml
,包含两个字段:
yaml
active-domain: <domain-name>
active-task: <task-name>
域全局存储在
~/.agents/ctxlayer/domains/
路径下。每个域包含任务文件夹,每个任务文件夹下有
docs/
data/
子目录。

Docs folder convention

文档文件夹规范

When the user asks to document something -- implemented features, research findings, search results, architecture decisions, diagrams, or any other form of documentation -- follow these steps:
  1. Read
    .ctxlayer/config.yaml
    to get
    active-domain
    and
    active-task
    .
    .ctxlayer
    folder is likely to be gitignored, so read it using command line.
  2. Navigate to
    ~/.agents/ctxlayer/domains/<active-domain>/<active-task>/docs/
    .
  3. Create a new markdown file using this naming convention:
    • Prefix: two-digit incrementing number based on existing files in the folder (
      01
      ,
      02
      ,
      03
      , ...).
    • Separator: a single dash.
    • Name: descriptive kebab-case summary of the content.
    • Extension:
      .md
      .
    • Examples:
      01-initial-research.md
      ,
      02-feature-implementation.md
      ,
      03-architecture-diagram.md
      .
  4. Write the content the user requested, in the format they requested.
Each file is a standalone document covering one topic. The docs folder serves as a running report and journal for the task.
当用户要求编写任何形式的文档(如记录已实现功能、研究成果、搜索结果、架构决策、图表等)时,请遵循以下步骤:
  1. 读取
    .ctxlayer/config.yaml
    获取
    active-domain
    active-task
    .ctxlayer
    文件夹可能已被git忽略,因此请通过命令行读取。
  2. 导航至
    ~/.agents/ctxlayer/domains/<active-domain>/<active-task>/docs/
    路径。
  3. 按照以下命名规范创建新的Markdown文件:
    • 前缀: 根据文件夹中现有文件的序号,使用两位递增数字(
      01
      02
      03
      ……)
    • 分隔符: 单个连字符
    • 名称: 采用kebab-case格式的内容描述性摘要
    • 扩展名:
      .md
    • 示例:
      01-initial-research.md
      02-feature-implementation.md
      03-architecture-diagram.md
  4. 按照用户要求的格式编写所需内容。
每个文件是涵盖单个主题的独立文档。文档文件夹作为任务的动态报告和日志使用。

Data folder convention

数据文件夹规范

The data folder at
~/.agents/ctxlayer/domains/<active-domain>/<active-task>/data/
holds reference material for the task: sample data, configuration snippets, external repositories, and anything else useful as a reference during implementation.
~/.agents/ctxlayer/domains/<active-domain>/<active-task>/data/
路径下的数据文件夹存储任务的参考资料:示例数据、配置片段、外部代码仓库,以及实现过程中任何有用的参考内容。

Cloning repos as context layer context

将代码仓库克隆为Context Layer上下文

When the user asks to "clone a repo as context" or to add a repository to the context layer context, do NOT run a regular
git clone
. Instead:
  1. Navigate to the task's
    data/
    folder.
  2. Run
    git submodule add <repo-url>
    to add the repository as a git submodule.
  3. Run
    git submodule update --init
    to initialize and fetch it.
This keeps the data folder lightweight and version-controlled via submodule references rather than full repository copies.
当用户要求“将仓库克隆为上下文”或向Context Layer上下文中添加仓库时,请勿运行常规的
git clone
命令。请执行以下步骤:
  1. 导航至任务的
    data/
    文件夹。
  2. 运行
    git submodule add <repo-url>
    将仓库添加为Git子模块。
  3. 运行
    git submodule update --init
    初始化并拉取仓库内容。
这种方式通过子模块引用而非完整仓库副本,保持数据文件夹的轻量化并实现版本控制。