index-at-creation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Index at Creation Time

创建时索引

Index artifacts when they're created, not at batch boundaries.
在工件创建时就对其建立索引,而非等到批量处理阶段。

Pattern

模式

If downstream logic depends on artifacts being queryable, index immediately at write time.
如果下游逻辑依赖于可查询的工件,请在写入时立即建立索引。

DO

应做事项

  • Index handoffs in PostToolUse Write hook (immediately after creation)
  • Use
    --file
    flag for fast single-file indexing
  • Trigger indexing from the same event that creates the artifact
  • 在PostToolUse Write钩子中索引交接内容(创建后立即执行)
  • 使用
    --file
    标志实现快速单文件索引
  • 从创建工件的同一事件触发索引操作

DON'T

不应做事项

  • Wait for SessionEnd to batch-index
  • Rely on cron/scheduled jobs for time-sensitive data
  • Assume data will be available "soon enough"
  • 等待SessionEnd进行批量索引
  • 依赖定时任务/计划任务处理时间敏感型数据
  • 假设数据会“足够快”地可用

Source Sessions

源会话

  • a541f08a: "Index at artifact creation time, not at SessionEnd"
  • 1c21e6c8: "If downstream logic depends on artifacts, index at the moment they're created"
  • a541f08a: "在工件创建时建立索引,而非SessionEnd时"
  • 1c21e6c8: "如果下游逻辑依赖工件,请在其创建的那一刻建立索引"