TRACK 2

🛠️ Hands-on

From diagnosis to proof, using the real scripts from the agente-claude-codex kit: measure the environment, split CLAUDE.md into portable and residue, install the core, port a skill from a single source, prove it in a fresh session on both runtimes and close with a handoff. Every step is reversible and leaves evidence.

doctor audit adapt init-core sync-skills readback handoff next session: prime reads the handoff and the cycle starts again audit mode implement mode · evidence

Read the staircase from left to right: the first two steps only read (audit); from the third step on, every step is reversible; readback glows because it is the proof; the cyan arrow shows the handoff feeding the next session.

6
Modules
36
Topics
~3h30
Duration
Interm.
Level
Track progress0%
0 of 36 topics

Track map

Prerequisite for this track: have the kit cloned (git clone https://github.com/inematds/agente-claude-codex) and at least one of the two runtimes installed. Module 2.1 checks this for you with scripts/doctor.sh.

Detailed content

2.1~35 min

🩺 Environment diagnosis

Before moving anything, measure: the agente-claude-codex kit ships an environment diagnosis (ok / warning / missing) and a read-only inventory that classifies every skill, hook, MCP and instruction. Nothing in ~/.claude or ~/.codex is touched.

0 of 6 · 0%
What it is:

The inematds/agente-claude-codex repo gathers scripts, prompts and the portable core template. You clone it once and run everything from inside it.

Why learn it:

Without the kit you redo by hand what is already automated and tested on this machine (readback approved in Claude and Codex).

Key concepts:

git clone https://github.com/inematds/agente-claude-codex, the scripts/, prompts/, template/ folders.

What it is:

A read-only script that checks git, python3, node, Claude Code, Codex CLI (skills, config, sandbox, MCP), polyskill and the kit's own files. Each item comes out as [ok], [aviso] or [FALTA] with the command to fix it.

Why learn it:

It answers "is my environment ready?" in seconds and exits with code 1 if something essential is missing, which makes automation possible.

Key concepts:

scripts/doctor.sh, exit code, warning ≠ missing, without Claude or Codex the step becomes "not run".

What it is:

Lists versions, skills, commands, subagents, hooks, plugins and MCP of both runtimes and writes a Markdown report to relatorios/auditoria-<data>.md.

Why learn it:

It is step 2 of the mega-prompts (MODE: audit): you see what exists before deciding what migrates.

Key concepts:

scripts/audit.sh, Claude → Codex gap, dated report, project × global separation.

What it is:

The audit classifies by heuristic (grep) every skill that exists only in Claude: reusable (pure Markdown), adapter (depends on a Claude MCP or plugin), native (depends on a hook) or unresolved. On this machine: 72 / 15 / 2 / 1.

Why learn it:

The matrix tells you where the effort is: 72 skills migrate without changes; the real blocker is the 15 MCPs, not the format.

Key concepts:

Heuristic classification, review case by case, MCP as the bottleneck, subagents and plugins do not migrate.

What it is:

On this host AppArmor restricts user namespaces and Codex's bwrap fails ("loopback: RTM_NEWADDR"). The readback that forced -s read-only broke; the minimal fix was to respect the sandbox_mode from config.toml.

Why learn it:

You will run into this on any similar Linux machine; doctor.sh already warns about it and the failure is in FALHAS.md with the smallest fix.

Key concepts:

bwrap, AppArmor, sandbox_mode = "danger-full-access", FALHAS.md (date, what broke, smallest fix, prompt or infra).

What it is:

The report in relatorios/ is not the end: each line becomes a decision (port, adapt, leave as Claude residue) that feeds the phased migration plan.

Why learn it:

Without turning the inventory into a plan you only have a pretty list; the source text insists that a file existing proves nothing.

Key concepts:

Dated report, matrix → phases, passed / failed / not run, versioned evidence.

View Full
2.2~35 min

✂️ CLAUDE.md → AGENTS.md

The only file truly tied to the provider is CLAUDE.md. Here you separate what is a portable rule (goes to AGENTS.md, read by Codex, Gemini and OpenCode) from what is specific to Claude Code, and make Claude import the portable part with @AGENTS.md.

0 of 6 · 0%
What it is:

Publishing rules, commit author, where the keys live, semver versioning, artifact destination: all of that is text any agent understands.

Why learn it:

It is most of your CLAUDE.md (71 of 78 lines in this machine's global one) and travels unchanged.

Key concepts:

Stable rule, path, convention, AGENTS.md as the source.

What it is:

Mentions of AskUserQuestion, superpowers, context-mode, claude-mem, fable-mindset, Artifact, advisor and hooks only make sense in Claude Code.

Why learn it:

If that goes into AGENTS.md, Codex reads instructions it cannot follow and the noise grows.

Key concepts:

Residue, plugin, hook, exclusive tool, 7 lines in the global file.

What it is:

The script reads the project's CLAUDE.md and writes AGENTS.proposto.md and CLAUDE.proposto.md next to it, for review. Nothing existing is touched.

Why learn it:

Reversible by construction: you review, rename, and only then does the project change.

Key concepts:

scripts/adapt-instructions.sh ~/projetos/meu-projeto, --dry-run, .proposto.md.

What it is:

The new CLAUDE.md starts with the line @AGENTS.md and only then brings the residue. Claude reads both; Codex reads only AGENTS.md.

Why learn it:

One source of truth for the portable rules, with no diverging copy.

Key concepts:

@ import, one source, residue kept separate, no duplication.

What it is:

AGENTS.md opens with "read 1) this file, 2) context/overview.md, 3) context/current-state.md, 4) tasks/current.md, 5) handoffs/latest.md". Those names are a repo convention; they are not loaded on their own.

Why learn it:

Prompt B is explicit: tell the agent what to read; do not assume auto-load.

Key concepts:

Reading order, convention ≠ auto-load, small briefing at the start.

What it is:

The script replaces every mention of "CLAUDE.md" with "AGENTS.md" in the portable part, including when the text is talking about another project's CLAUDE.md. That changes the meaning.

Why learn it:

That is why the output is .proposto.md: human review catches this case.

Key concepts:

Blind renaming, review references, sed is dumb, a human approves.

View Full
2.3~35 min

🧱 Install the portable core

The portable core is a set of Markdown files with a defined owner: AGENTS.md, context/, tasks/current.md, handoffs/latest.md. init-core.sh copies the template into the project and lists what it created and what it kept.

0 of 6 · 0%
What it is:

Copies template/ into the project file by file; if it already exists, it keeps it and reports [mantido]; if not, it creates it and reports [criado].

Why learn it:

The first version of the kit used cp -r and overwrote README and CLAUDE.md; the fix was the "never overwrite" rule.

Key concepts:

scripts/init-core.sh ~/projetos/meu-projeto, created, kept, reversible.

What it is:

context/overview.md has a header (ID, scope, source, date, status, review by) and sections: what it is, verified facts, preferences, hypotheses.

Why learn it:

Separating fact from hypothesis is what settles "which version is the right one" later.

Key concepts:

ID, scope, source, observation date, status, fact × preference × hypothesis.

What it is:

A file that says what is being done right now, who owns it, what the verifiable definition of done is and the concrete next action.

Why learn it:

It is what makes the agent understand the current work, not just the history.

Key concepts:

Goal, owner, definition of done, next action, blockers.

What it is:

Each accepted decision becomes a dated file in context/decisions/ with context, decision and consequences. Status: proposed, accepted, revoked.

Why learn it:

An accepted decision beats a timestamp: that is the plan's conflict rule.

Key concepts:

Dated decision, status, provenance, never delete, revoke.

What it is:

An 8-line check: the required files exist and are not empty. Exits 0 or 1.

Why learn it:

A small, real check is worth more than a pretty structure nobody validates.

Key concepts:

bash scripts/check.sh, [ok] / [FALTA], exit code.

What it is:

Clone the project on its own into a clean folder and run the check. Prompt B requires it: essential context inside the project, without depending on ../../knowledge.

Why learn it:

Proof of portability: if it depends on a parent folder, it is not portable.

Key concepts:

Clean clone, no dependency on a parent folder, check passes, evidence.

View Full
2.4~40 min

🧩 Canonical skills with polyskill

Instead of skill-claude, skill-codex, skill-dsh copied by hand, one canonical skill generates the per-runtime copies. sync-skills.sh wraps polyskill: import, build, install with backup, drift.

0 of 6 · 0%
What it is:

On this machine, dsh-sandbox has 3 skills hand-copied from formato-curso-inema. Every edit at the source never reaches the copies: guaranteed drift.

Why learn it:

Four consumers (Claude 117, Codex 27, dsh 3, openpcbotv3 16) without a single source drift on their own.

Key concepts:

Drift, manual copy, canonical source, adapter at the edges.

What it is:

scripts/sync-skills.sh import session-handoff reads ~/.claude/skills/session-handoff and writes skills/session-handoff/ in the portable format.

Why learn it:

The skill stops being "Claude's" and becomes a neutral source.

Key concepts:

polyskill import --from claude, definition.md, polyskill.yaml, extensions preserved or flagged.

What it is:

scripts/sync-skills.sh build generates skills/*/dist/<runtime>/. With FORCE=1 it overwrites a hand-edited target.

Why learn it:

The per-runtime copy is derived, never edited: edit the source and rebuild.

Key concepts:

dist/, derived, --force, never edit a copy.

What it is:

scripts/sync-skills.sh install session-handoff --both copies to ~/.claude/skills and ~/.codex/skills (and mirrors into ~/.agents/skills), making a .name.bak-<ts> backup if one already existed.

Why learn it:

Installing is the only action that touches the runtimes' home; hence the backup first.

Key concepts:

--both, --claude, --codex, backup alongside, ~/.agents/skills.

What it is:

scripts/sync-skills.sh drift compares each dist/ with what is installed. Exits 1 if there is any difference.

Why learn it:

It is the test that nobody edited the copy from outside; it goes into the acceptance criteria.

Key concepts:

diff -rq, [ok], [DRIFT], [not installed], exit code.

What it is:

The 15 "adapter" skills (heygen, magnific, printing-press…) reference MCP tools. In Codex they only work after registering the server with codex mcp add.

Why learn it:

Porting before MCP produces a skill that does not run; order matters.

Key concepts:

MCP in Codex, codex mcp add, keys referenced from .env, never copy the value.

View Full
2.5~35 min

✅ Readback: prove it in a fresh session

A file existing is not proof. The readback opens a new session in Claude (claude -p) and in Codex (codex exec) inside the project and asks five questions. Pass: the answers cite the right files.

0 of 6 · 0%
What it is:

Current goal and definition of done; one rule with the exact source file; last accepted decision; concrete next action; conflicts, stale facts or missing access. Separate what the files establish from what the agent infers.

Why learn it:

It is prompt B's continuity test: did it find, read, understand, use?

Key concepts:

Fresh-session readback, no prior conversation, cite the source, inference marked.

What it is:

scripts/readback-test.sh ~/projetos/meu-projeto both runs both and saves the raw answer to relatorios/readback-<runtime>-<data>.md.

Why learn it:

It automates the collection; the verdict is still yours.

Key concepts:

claude -p, codex exec --skip-git-repo-check, report per runtime, config.toml sandbox.

What it is:

Criterion: AGENTS.md, tasks/current.md and handoffs/latest.md show up cited and the "next action" matches the task.

Why learn it:

Pretty prose without a citation is context hallucination; a citation is evidence.

Key concepts:

File citation, next action matches, passed / failed.

What it is:

In the first passing readback, Codex found a missing handoff, a wrong sum in the audit and a contradictory sentence in the plan. All fixed on the spot.

Why learn it:

The readback does not just prove, it audits: a fresh agent reads without the bias of whoever wrote it.

Key concepts:

Inconsistency, audit by fresh session, recorded fix.

What it is:

Two real failures: forced sandbox (-s read-only) and the audit count. Each becomes one line: date, what broke, smallest fix, prompt or infra.

Why learn it:

After about 10 lines the pattern shows up and you stop rebuilding what only needed a safeguard.

Key concepts:

FALHAS.md, smallest fix, prompt × infra, one line per failure.

What it is:

Passed: it cited the files and the action matches. Failed: it ran and did not cite. Not run: runtime missing, sandbox broke, or nobody ran it. No evidence counts as not run.

Why learn it:

The source PDF admits it: no live test was done by the authors. Your readback is the first real evidence.

Key concepts:

Three states, saved evidence, never "probably passed".

View Full
2.6~35 min

🔁 Handoff and prime: the daily cycle

The flow that makes everything work day to day: when closing the session, the agent writes a handoff in Markdown; when opening the next one, in any runtime, it reads that handoff before acting. The JSONL sessions become history, not source.

0 of 6 · 0%
What it is:

Project and scope, goal, accepted state, changed files, checks run with results, open questions, exact next action. No credentials, no "it's in another worktree".

Why learn it:

A good handoff replaces rereading 2.3 GB of JSONL.

Key concepts:

Decision, open item, next step, file path, no secrets.

What it is:

The kit's template has 7 fixed sections. latest.md is always the most recent; older versions can stay in handoffs/YYYY-MM-DD.md.

Why learn it:

A fixed structure is what lets another runtime (or another person) pick up without guessing.

Key concepts:

latest.md, fixed sections, dated, one structure for all.

What it is:

Prime is reading AGENTS.md → context → tasks → handoffs at the start. In Claude it becomes a skill; in Codex, an instruction in AGENTS.md; in dsh, a prime skill.

Why learn it:

Without prime, the handoff is a file nobody reads.

Key concepts:

Prime, reading order, skill × instruction, small briefing.

What it is:

The final test: a handoff written in a Claude session, picked up in a fresh Codex session, and vice versa, in a real project.

Why learn it:

That is the definition of done for the whole system.

Key concepts:

Cross handoff, same Markdown, interchangeable executors.

What it is:

On this machine: 6,859 Claude sessions (2.3 GB) and 209 Codex sessions. Once the cycle is running, archive those older than 90 days.

Why learn it:

Raw memory is raw material; what counts is what got promoted to an overview or a handoff.

Key concepts:

JSONL, archive, promote a fact, raw material × source.

What it is:

No session ends without handoffs/latest.md and tasks/current.md updated. The next day's readback is the check.

Why learn it:

It is the only discipline that makes switching models painless.

Key concepts:

End of session, update two files, readback as audit.

View Full