---
title: "codex-sift-plugin"
description: "Compresses large Codex tool outputs with sift and reports saved tokens."
canonical: https://agentpluginsdirectory.com/plugins/codex-sift-plugin
last-updated: 2026-09-13
---

# codex-sift-plugin
Compresses large Codex tool outputs with sift and reports saved tokens.
- Slug: codex-sift-plugin
- Publisher: agent-context
- Repository: https://github.com/agents-sdk/sift-plugins
- Manifest: codex-sift-plugin/plugin.json
- Version: 0.1.1
- License: Apache-2.0
- Category (editorial): other
- Skills: 1 (sift-context)
- MCP servers: 1 (sift)
- Stars: 0
- Repository created: 2026-08-28
- Repository last pushed: 2026-09-13
- Publisher type: Organization
- Listing: https://agentpluginsdirectory.com/plugins/codex-sift-plugin
- Schema: https://agent-plugins.org/schemas/1.0.0/plugin.schema.json

## What codex-sift-plugin does, in the publisher's words

面向 Codex CLI 与 Codex App 的 Sift 适配器。它使用正式的 Codex 插件包、PostToolUse / SessionStart hooks 和本地 MCP server，不修改 Codex 源码。

- PostToolUse 收到本地工具的结构化结果；失败、宿主已标记截断、过短和排除工具直接透传。
- Sift 压缩其中的大字符串。若压缩有损，原文写入插件私有数据目录的 session stash，并在结果中保留 >。
- hook 返回 continue: false 和压缩后的 stopReason。这是 Codex 0.145.0 官方支持的"用 hook feedback 替换原工具结果"路径；副作用已经发生，不会被撤销。
- 每次成功压缩向 savings.ndjson 追加一条事件，并按 session_id + tool_use_id 去重统计。
- MCP server 暴露 sift_retrieve 和 sift_stats。

插件采用 portable Agent Plugins 1.0 的根 plugin.json + mcp.json，并为 Codex 0.145.x 保留.codex-plugin/plugin.json +.mcp.json 兼容入口。0.145.x 不会为兼容 MCP 展开插件变量或注入 PLUGIN_DATA，所以两代入口都统一使用 ~/.codex/sift（可通过 CODEX_SIFT_DATA 覆盖），确保 hook、stash、统计工具看到同一份数据。

仅本地 function tools、Bash / unified exec、apply_patch 和 MCP tools 经过 Codex hooks；托管的 WebSearch 等工具不经过该路径。代码模式下 continue: false 会把压缩 feedback 作为结果交给脚本且不会 reject；decision: block 没有被采用，因为它会让嵌套 tool promise reject。

- hook 的 systemMessage：压缩成功后显示 Sift saved X tokens in this session，但属于提示/警告，不是常驻 sidebar/footer；

From the project README, punctuation lightly normalized. Full text: https://raw.githubusercontent.com/agents-sdk/sift-plugins/HEAD/codex-sift-plugin/README.md

## Skills

- sift-context: Use when a Codex tool result contains a <<stash:KEY>> marker, when the user asks how much context Sift saved, or when diagnosing the Codex Sift plugin.

Descriptions come from the frontmatter of each SKILL.md, punctuation lightly normalized.

## MCP servers

- sift: transport: stdio; command: node ${PLUGIN_ROOT}/dist/mcp/server.js

Read from the plugin's own mcp.json. Environment variable names only, never values.
