agentleFS
wwwrootwwwroot/ai-codex/skills/codex-deep/SKILL.md

codex-deep

Skill1 starsChanged 4 months agoMITView on GitHub

Conducts first-principles technical research, mathematical derivations, algorithm design, and cross-domain invention for complex engineering challenges. Generates timestamped research specifications and mathematical models inside codex-drive/specs/.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When confronting hard computational limits (latency, throughput, cache contention, mathematical optimization)

    line 24
  2. Very specific:

    All research documents generated by codex-deep MUST be Markdown (.md) files with exact date-time metadata.

    line 66

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Codex Deep — First-Principles Research & Invention Skill

The deep research and invention engine of AI Codex. Explores theoretical foundations, derives mathematical proofs, invents novel algorithms, and solves problems where no conventional solution exists.


Overview

codex-deep is designed for engineering challenges that require stepping outside standard libraries and patterns. It approaches problems from first principles — stripping away conventional assumptions, analyzing theoretical physics/math/computational limits, designing bespoke data structures or algorithms, and producing rigorous research artifacts in codex-drive/specs/.


When to Trigger

  • User runs /codex-deep (e.g., /codex-deep invent lock-free ring buffer for GPU-CPU shared memory, /codex-deep mathematical modeling of token bucket rate limiter, /codex-deep design spatial partitioning grid for 1M entities)
  • When confronting hard computational limits (latency, throughput, cache contention, mathematical optimization)
  • Designing custom algorithms, protocols, compression codecs, or memory layouts

Execution Workflow

 ┌────────────────────────────────────────────────────────┐
 │ 1. STRIP TO FIRST PRINCIPLES & FUNDAMENTAL INVARIANTS  │
 │    Define the problem in terms of physics, math & CLR. │
 └──────────────────────────┬─────────────────────────────┘
                            │
                            ▼
 ┌────────────────────────────────────────────────────────┐
 │ 2. THEORETICAL DERIVATION & MATHEMATICAL PROOF         │
 │    Formulate formulas, state invariants, complexity.   │
 └──────────────────────────┬─────────────────────────────┘
                            │
                            ▼
 ┌────────────────────────────────────────────────────────┐
 │ 3. ALGORITHM & DATA STRUCTURE SYNTHESIS                │
 │    Design pseudo-code, memory layout, and access paths.│
 └──────────────────────────┬─────────────────────────────┘
                            │
                            ▼
 ┌────────────────────────────────────────────────────────┐
 │ 4. GENERATE TIMESTAMPED RESEARCH SPEC IN CODEX-DRIVE   │
 │    Write codex-drive/specs/YYYY-MM-DD-<slug>.research.md│
 └──────────────────────────┬─────────────────────────────┘
                            │
                            ▼
 ┌────────────────────────────────────────────────────────┐
 │ 5. TRANSITION TO PROTOTYPING & BENCHMARKS              │
 │    Recommend verification harness via /codex-test.     │
 └────────────────────────────────────────────────────────┘

Research Spec File Specification (codex-drive/specs/)

All research documents generated by codex-deep MUST be Markdown (.md) files with exact date-time metadata.

Filename Format:

codex-drive/specs/YYYY-MM-DD-<slug>.research.md

Standard Research Document Template:

# [Topic / Invention Name] Technical Research & Proof

> **Created At**: YYYY-MM-DD HH:MM:SS (Local Time)
> **Active Codex Edition**: [`skills/codex/<edition>/`](file:///...)
> **Status**: THEORETICAL_DRAFT | VALIDATED | BENCHMARKED
> **Domain**: [e.g., Lock-Free Concurrency / High-Performance Computing / Algorithmic Geometry]

---

## 1. Problem Statement & First-Principles Framing
- **Surface Problem**: [What is conventionally stated]
- **Fundamental Root Problem**: [Physical / mathematical constraint: memory bus bandwidth, CPU cache line false sharing, $O(N^2)$ algorithmic wall]
- **Conventional Assumptions Rejected**: [Why existing off-the-shelf solutions fail]

## 2. Mathematical Modeling & Theoretical Limits
- **Formulation**:
  $$\text{Throughput}(N) = \frac{C \cdot \text{CacheLineSize}}{\text{AtomicContentionTime}(N) + \text{MemoryLatency}}$$
- **Complexity Guarantees**:
  - Time Complexity: Best Case $O(1)$, Worst Case $O(1)$ amortized
  - Space Complexity: $O(K)$ fixed contiguous buffer (Zero Heap Allocations)

## 3. Algorithm & Memory Layout Synthesis

Cache Line 0 (64 Bytes) Cache Line 1 (64 Bytes) ┌───────────────────────────────────┬───────────────────────────────────┐ │ Head Pointer (Atomic u64, 8B) │ Tail Pointer (Atomic u64, 8B) │ │ Cache Padding (56B) │ Cache Padding (56B) │ └───────────────────────────────────┴───────────────────────────────────┘


### Pseudo-Code / Reference Logic:
```rust
// Core algorithmic state without false sharing
pub struct LockFreeRingBuffer<T, const CAPACITY: usize> {
    head: CachePadded<AtomicU64>,
    tail: CachePadded<AtomicU64>,
    slots: [UnsafeCell<Slot<T>>; CAPACITY],
}

4. Invariant Analysis & Safety Proofs

  • Invariant 1: Head index never exceeds Tail index plus Buffer Capacity.
  • Invariant 2: Atomic memory ordering (Acquire/Release) ensures data visibility before index update.
  • Deadlock Freedom: Zero locking primitives; progress is guaranteed by compare-and-swap (CAS) loops.

5. Potential Failure Modes & Mitigation

  • ABA Problem: Solved via 64-bit monotonic sequence tags.
  • Cache Contention: Solved via explicit hardware cache-line padding (64/128 bytes).

6. Prototyping & Benchmarking Strategy

  • Recommendation to execute microbenchmarks and stress tests via /codex-test.

---

## Response Protocol

When `codex-deep` finishes:
1. Provide a direct link to `[View Research Spec](file:///.../codex-drive/specs/YYYY-MM-DD-<slug>.research.md)`.
2. Summarize the theoretical breakthrough, algorithmic guarantees, or mathematical proofs.
3. Suggest next steps: `/codex-plans` for integration, or `/codex-test` for microbenchmarking.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.