memex-cli
Execute AI tasks (codex/claude/gemini) with memory and resume support via memex-cli stdin protocol.
What this skill does
# Memex CLI A CLI wrapper for AI backends (Codex, Claude, Gemini) with built-in memory and resume capabilities. ## Core Concepts memex-cli uses **stdin protocol** to define tasks, allowing: - Multi-backend AI execution (codex, claude, gemini) - Parallel and sequential task orchestration - Resume from previous runs with full context ## Basic Task Syntax ```bash memex-cli run --stdin <<'EOF' ---TASK--- id: <task_id> backend: <backend> workdir: <working_directory> timeout: 3000000 ---CONTENT--- <task content here> ---END--- EOF ``` ### Required Parameters | Parameter | Description | Example | |-----------|-------------|---------| | `id` | Unique task identifier | `implement-auth-20260110` | | `backend` | AI backend | `codex`, `claude`, `gemini` | | `workdir` | Working directory path | `<working_directory>` or `/home/user/app` | | `<TASK_CONTENT>` | Step by step instructions for the task | `Implement authentication module` | ### Optional Parameters | Parameter | Description | Example | |-----------|-------------|---------| | `role_prompt` | Task role prompt path | `prompts/developer_role.md` | | `dependencies` | Task dependencies | `task-a` or `task-a,task-b` | | `timeout` | Timeout in seconds | `3000000`| | `files` | File Or Directory paths to load | `src/**/*.py` (glob supported) | ## Task Content Generate Write task content as explicit, step-by-step instructions with clear outputs. ### Recommended Structure 1. Objective: What must be achieved. 2. Scope: Which files, modules, or boundaries are included. 3. Steps: Ordered implementation or analysis actions. 4. Output: What artifacts or results must be returned. 5. Validation: How to verify correctness. ### Template ```text Objective: - <target outcome> Scope: - <file/module boundaries> Steps: 1. <step 1> 2. <step 2> 3. <step 3> Output: - <expected deliverable> Validation: - <verification criteria> ``` ### Example: Single Task Content ```text Objective: - Implement JWT authentication for login and protected routes. Scope: - src/auth/** - src/middleware/** Steps: 1. Add token generation and verification utilities. 2. Add auth middleware for protected endpoints. 3. Add input validation and error handling. Output: - Updated authentication module and middleware. - Brief summary of changed files and behavior. Validation: - Login returns a valid token. - Protected route rejects invalid or missing tokens. ``` ### Example: Multi-Task Content Split Use focused task content per task when using multi-task execution: - Planning task: architecture and implementation plan only. - Implementation task: code changes only, based on approved plan. - Validation task: tests, review, and quality checks only. ### Quality Checklist - Avoid vague verbs such as "improve" or "optimize" without measurable criteria. - Include explicit constraints (performance, compatibility, security) when required. - Keep each task content scoped so completion can be clearly verified. ## Backend Selection Guide ### Codex Specialized in deep code analysis, large-scale refactoring, and performance optimization. - **Deep Code Analysis & Understanding** — Analyze complex implementations with comprehensive understanding, navigate intricate dependencies, and identify architectural patterns in mixed-language codebases. - **Large-Scale Refactoring** — Execute precise refactoring across multiple files with accurate dependency tracking, ensuring no references are broken during structural transformations. - **Algorithm & Performance Optimization** — Identify performance bottlenecks, optimize algorithms, and provide detailed optimization strategies with measurable improvements. ### Claude Specialized in fast feature delivery from clear requirements, technical documentation design, and professional prompt engineering. - **Quick Feature Implementation from Clear Requirements** — Quickly translate well-defined product or engineering requirements into practical implementation plans and deliver features efficiently. - **Technical Documentation Design & Writing** — Produce clear, professional technical documents such as API specifications, integration guides, architecture notes, and README files. - **Professional Prompt Engineering** — Craft high-quality prompts for product requirements, design specifications, workflow orchestration, and other structured AI-assisted development tasks. ### Gemini - **UI Skeletons & Layout Prototyping** — Build clear UI skeletons and layout prototypes to quickly validate information architecture and page structure. - **Consistent Design System Implementation** — Implement interfaces with a consistent design language, including reusable components, spacing rules, and visual patterns. - **Interactive and Accessible Elements** — Create interactive, accessible UI elements with clear states, keyboard support, and usability-focused interactions. ## Task ID Patterns **Recommended patterns:** ``` # Timestamp format (unique) task-20260110143052 implement-auth-20260110143052 # Semantic format (readable) design-api implement-backend test-integration # Hierarchical format (organized) auth.design auth.implement auth.test ``` Avoid generic IDs like `task1`, `task2`. ## Role Prompt Use `role_prompt` to attach a predefined role instruction file to a task. ### When to Use - Enforce consistent behavior across repeated tasks. - Apply domain-specific expertise (for example, backend engineer, QA reviewer, or API architect). - Separate reusable role guidance from task-specific content. ### Format - `role_prompt` should be a readable file path relative to `workdir`. - Keep role prompt files concise and focused on role behavior, constraints, and output style. ### Example ```bash memex-cli run --stdin <<'EOF' ---TASK--- id: implement-auth-with-role backend: codex workdir: <working_directory> role_prompt: prompts/developer_role.md timeout: 3000000 ---CONTENT--- Implement JWT-based authentication with input validation and tests. ---END--- EOF ``` ### Best Practices - Reuse stable role prompt files instead of duplicating instructions in every task. - Keep task content focused on concrete goals; keep role behavior in `role_prompt`. - Version and review role prompt files like code to maintain quality. ## File References Use `files` to load relevant context into a task. You can reference single files, directories, or glob patterns. ### Common Reference Patterns - Single file: `files: ./README.md` - Directory: `files: ./docs/` - Glob pattern: `files: src/**/*.ts` - Multiple `files` entries: use commas to separate paths ### Example ```bash memex-cli run --stdin <<'EOF' ---TASK--- id: api-doc-review backend: claude workdir: <working_directory> timeout: 3000000 files: ./README.md,./docs/api/*.md ---CONTENT--- Review API documentation consistency and suggest improvements. ---END--- EOF ``` ## Multi-Task Execution Run multiple tasks in a single stdin payload. memex-cli automatically schedules tasks by dependency: - Tasks without `dependencies` run in parallel. - Tasks with `dependencies` run after their prerequisite tasks complete. ### Example A: Parallel Execution Use this when tasks are independent and can run at the same time. ```bash memex-cli run --stdin <<'EOF' ---TASK--- id: analyze-frontend backend: codex workdir: <working_directory> timeout: 3000000 ---CONTENT--- Analyze the frontend module and list refactoring opportunities. ---END--- ---TASK--- id: review-api-contract backend: claude workdir: <working_directory> timeout: 3000000 ---CONTENT--- Review API contract consistency and propose improvements. ---END--- EOF ``` ### Example B: DAG (Dependency-Aware) Execution Use this when later tasks depend on earlier outputs. ```bash memex-cli run --stdin <<'EOF' ---TASK--- id: plan-feature backend: claude workdir: <working_directory> timeout: 3000000 ---CONTENT--- Create an implementation plan for the notification feature. ---END--- ---TASK--- id: implement-feature backend: codex workdir: <wo
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.