Home / All Skills / Workflow & Core Tools / codex-image-to-eagle
Workflow & Core Tools · vibeshotclub/vsc-skills

codex-image-to-eagle

Archive Codex-generated images from the current user's Codex generated_images directory into Eagle with the prompt saved as annotation. Use when the user asks to save, archive, import, or sync Codex generated images to Eagle with prompts, tags, and folders.

L4 High-Privilege · Graded auth & full auditV1 Commit-PinnedExecute CommandNetwork AccessWrite FileDual-pass Audit
Author vibeshotclubGitHub vibeshotclub/vsc-skills ↗Stars 832License 仓库未提供 LICENSE 文件(find 全仓无 LICENSE*;GitHub API license 字段为 null)Commit fcee81beb6
Control levels describe skill capabilities and suggested control measures; they do not represent quality or safety certifications, nor do they dictate usability. Usage decisions rest entirely with users and administrators. Different agent hosts apply varying constraints; do not assume hosts provide automatic protection. Third-party skill copyrights belong to their original authors. Use at your own risk.

1How It Works & Mechanism

The core is a Node script: it scans the Codex generated image directory, selects images, builds the item_add payload, and writes the image paths and prompts into the Eagle library.

codex-image-to-eagle/SKILL.md
Archive images generated by Codex into Eagle and preserve the prompt as searchable metadata.
The script is 822 lines long and strictly uses Node built-in fs/path/http/os/child_process modules with zero npm dependencies.

There are two communication pathways to Eagle: by default, it uses a local HTTP loopback endpoint; if an Eagle stdio MCP entry exists in the local Codex configuration, it automatically switches to stdio (spawning a child process).

codex-image-to-eagle/SKILL.md
Stdio mode: the script reads the current user's `~/.codex/config.toml`, prefers `[mcp_servers.eagle]`, and can auto-detect other Eagle-like stdio MCP entries. Use `--transport http` to force the legacy HTTP path.
transportName() automatically determines this based on whether an Eagle entry exists in config.toml when --transport is not explicitly specified.

The HTTP path performs a POST /api/tools/call against a local loopback address, with a JSON request body of {tool, params}.

codex-image-to-eagle/scripts/archive-codex-image-to-eagle.js
path: '/api/tools/call',
The default address comes from the DEFAULT_SERVER constant and can be overridden by EAGLE_SERVER_URL.

The stdio path uses child_process.spawn to launch the command defined in the config, passing the host's entire process.env through to the child process (overlaid with any env in the config).

codex-image-to-eagle/scripts/archive-codex-image-to-eagle.js
this.child = spawn(this.config.command, this.config.args || [], {
Immediately followed by a line: `env: { ...process.env, ...(this.config.env || {}) },`.

Folder resolution relies on 'exact parent-child paths' rather than just names: it first resolves the root folder upward, then searches for date folders under the root by name+parentId to prevent accidental cross-linking between identically named folders.

codex-image-to-eagle/SKILL.md
- Folder safety: resolve folders by exact parent-child path, not by name alone.
SKILL.md also defines 5 numbered rules to enforce this discipline in direct Eagle MCP tool invocation scenarios.

Concurrency safety uses local file locks (a lock directory named after a parameter hash under os.tmpdir) to serialize the critical section of 'check folder → create folder'.

codex-image-to-eagle/scripts/archive-codex-image-to-eagle.js
const lockDir = path.join(os.tmpdir(), `codex-image-to-eagle-${hashKey(key)}.lock`);
Defaults to a 15s timeout and 150ms polling interval, which can be overridden by EAGLE_FOLDER_LOCK_TIMEOUT_MS / EAGLE_FOLDER_LOCK_POLL_MS.

Prompts and provenance metadata are written into Eagle's annotation field using a fixed text template, establishing searchable review metadata.

codex-image-to-eagle/scripts/archive-codex-image-to-eagle.js
'- source: Codex',
buildAnnotation() produces three sections: Prompt: … / Archive: - source/- original_path/- archived_at.

Idempotency and deduplication: if multiple date folders with the same name already exist under the same root folder, it reuses the oldest one and reports duplicates instead of creating a new one.

codex-image-to-eagle/SKILL.md
If more than one matching date folder already exists under the same root, reuse the oldest existing folder ID and report the duplicate instead of creating another one.
On the code side, findFolderByNameAndParent() sorts by createdAt ascending and picks the first.

2Core Capabilities

01Three image selection strategies: --latest (most recent single image) / --latest-session (all images in the newest session directory) / --path (specified file)
02Prompt transfer: writes into Eagle annotation, supporting --prompt / --prompt-file / --prompt-stdin
03Default tags Codex / AI-generated / Prompt, with support for appending via --tags (JSON array or comma-separated)
04Archives by local generation date into root/YYYY-M-D subdirectories, with --no-date-subfolders available to fall back to flat archiving
05Automation-friendly: fixing the folder ID can bypass folder_get/folder_create permission confirmations
06--dry-run preview and --check-connection connectivity self-check
07Cross-platform default path: ~/.codex/generated_images (can be overridden by CODEX_GENERATED_IMAGES_DIR)

3External Dependencies

KindDependency / Endpoint
packageNode.js(无 npm 依赖,仅内置 fs/path/http/os/child_process)
networkEagle MCP Server(本地回环 HTTP)
networkEagle MCP Server(本地回环,README 侧写为 localhost 同端口)
cliEagle 桌面应用 + Eagle MCP 插件(第三方,必须运行才能写入)
clistdio MCP 代理子进程(从 ~/.codex/config.toml 解析出的 command/args,如 mcp-proxy.js)

4Recommended Governance & Evidence

Suggested Controls for Safe Operation
For Agent Runtime
Graded/per-use authorization, sandbox recommended
For Administrators
Approval workflow, rollback support, full audit
Evidence & Triggers (File Paths & Excerpts)
  • scripts/: Executes local script or command: node scripts/archive-codex-image-to-eagle.js (bundled script triggered by agent via Bash(node *))
  • 网络端点: Declared external network access: Local loopback only: HTTP POST http://127.0.0.1:41596/api/tools/call (can be overridden by EAGLE_SERVER_URL)
  • 本地工作目录: File I/O and artifact output: Local only: creates/deletes <hash>.lock directories under os.tmpdir() to serialize folder creation; does not write images or modify source files
Audit Notes: Trigger conditions and rationale: ① The default path reads the user-level configuration file ~/.codex/config.toml and spawns a child process accordingly, passing the host's entire process.env into the child process upon spawn—representing a code execution surface dependent on local configuration to determine execution details; ② Strongly depends on third-party software and plugins (Eagle + Eagle MCP plugin + possible mcp-proxy.js), forming a third-party dependency chain; ③ Writes folders and assets into the local asset library. Mitigating factors: Zero outbound internet calls (strictly 127.0.0.1 loopback), does not delete or modify source files, supports --dry-run preview, and folder operations utilize local locks with exact parent-child path matching. Risk increases on shared machines or when configuration is altered by third parties.

5Second-Pass Verification

  • [ok] 每条外部依赖的反查 — Node 依赖:脚本 require 仅 fs/path/http/os/child_process,无 node_modules、无 package.json;Eagle 回环端点:DEFAULT_SERVER 常量 + callTool() 的 http.request 两处互证;stdio 子进程:spawn 调用点 + README 的 mcp-proxy.js 示例互证。
  • [ok] 是否有被遗漏的网络调用 — 全文件仅 import http 一处,唯一 http.request 出现在 httpRequest(),被 callTool() 以 DEFAULT_SERVER 构造的 hostname/port 使用;无 fetch/https/axios/WebSocket。
  • [ok] 凭证读取结论的反例搜索 — process.env 命中集中在配置项(图片目录/服务地址/文件夹 ID/MCP 参数/锁超时),未见读取密钥文件、keychain、.env 或打印敏感值;但 spawn 透传全量 env 确认成立,故归入橙档依据之一。
  • [ok] 文件夹安全规则 vs 代码实现 — SKILL 第 1–5 条规则均可在代码定位:fixedFolderId 短路、folder_get(getAllHierarchy/fullDetails)、findFolderByNameAndParent(name+parentId)、folder_create(parentId)、复用最旧(按 createdAt 升序取 matches[0])。
  • [ok] 默认服务地址描述一致性 — SKILL.md/脚本为 127.0.0.1:41596 并说明优先 IPv4 回环的原因;README 写 localhost:41596。二者同端口不同写法,已分别作为独立条目取证,不视为出入。
  • [ok] 功能声明与实现相符度 — description 承诺的 save/archive/import/sync + prompt/tags/folders 全部有对应实现(item_add 载荷含 tags/items、annotation、folders);『不泛化为任意素材库迁移』与代码仅面向 Eagle 相符。
  • [ok] dry-run 是否真的不写库 — resolveFolderPath() 在 dryRun 时直接返回伪造的 folder-path 字符串,main() 在 dryRun 分支提前 return,未调用 item_add —— 预览路径无写入,结论成立。

6Verdict & Scenarios

  • Archives generated images together with original prompts; storing prompts in Eagle annotations makes them searchable, solving the link most prone to being lost in AIGC review.
  • Solid engineering details: local file locks prevent concurrent creation of duplicate date folders, and folders are resolved accurately via parent-child paths.
  • Clear safety terms including --dry-run and 'no deletion/moving of source files', keeping the cost of accidental operations low.
  • Dual-channel support (loopback HTTP / stdio MCP) covers both integration modes of the Eagle plugin, candidly noting that child processes under shell sandboxes may inherit restrictions.
  • Best for: Ideal for creators who batch-generate images with Codex and already manage assets using Eagle: archives 'images + original prompts + tags + date folders' in one go for easy future retrieval and prompt reuse; also suitable for unattended automated archiving (fixing EAGLE_CODEX_FOLDER_ID/ROOT_FOLDER_ID reduces permission popups).
    Not for: Not suitable for users without Eagle or unwilling to install the MCP plugin (this skill offers no alternative pathway); not suitable for migrating non-Codex image sources or other asset libraries (vsc-distinction explicitly avoids generalization); not suitable for repeated real import runs with a 'just trying it out' mindset—duplicate assets will clutter the library, so --dry-run should be used first.
    Install Agent-Ready
    ① Verified Mirror 2026-09-15
    Option A · Direct DownloadDownload codex-image-to-eagle.tar.gz
    sha256: 5914cacc5fbf46dc…
    Option B · Copy Guide for Agent
    install.json
    Agents automatically download and verify mirrors from this JSON guide.
    ② Upstream GitHub
    GitHub Repo ↗
    Pinned to commit fcee81beb6.