claude-init 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/PR.md +1 -1
- package/.claude/settings.json +17 -2
- package/.claude/skills/codex-review-code/SKILL.md +174 -0
- package/.claude/skills/codex-review-plan/SKILL.md +176 -0
- package/.claude/skills/codex-usage-check/SKILL.md +57 -0
- package/.claude/skills/codex-usage-check/scripts/check-codex-usage.sh +4 -0
- package/README.md +23 -2
- package/package.json +1 -1
- package/src/cli.js +18 -0
- package/.claude/commands/codex-usage.md +0 -1
- package/.claude/commands/summarize.md +0 -1
package/.claude/commands/PR.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
generate git PR title and description for $ARGUMENTS
|
|
1
|
+
generate git PR title and description for $ARGUMENTS in markdown format
|
package/.claude/settings.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
|
-
"WebSearch"
|
|
4
|
+
"WebSearch",
|
|
5
|
+
"Skill(codex-review-code)",
|
|
6
|
+
"Skill(codex-review-plan)"
|
|
5
7
|
],
|
|
6
8
|
"deny": [
|
|
7
9
|
"Read(**/.env*)",
|
|
@@ -17,5 +19,18 @@
|
|
|
17
19
|
"type": "command",
|
|
18
20
|
"command": "npx ccusage statusline"
|
|
19
21
|
},
|
|
20
|
-
"alwaysThinkingEnabled": true
|
|
22
|
+
"alwaysThinkingEnabled": true,
|
|
23
|
+
"hooks": {
|
|
24
|
+
"Stop": [
|
|
25
|
+
{
|
|
26
|
+
"hooks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "command",
|
|
29
|
+
"command": "CHANGED=$(git diff --name-only HEAD 2>/dev/null; git ls-files --others --exclude-standard 2>/dev/null); if [ -n \"$CHANGED\" ]; then echo '{\"decision\":\"block\",\"reason\":\"Uncommitted changes since last commit. Run the codex-review-code skill to get a Codex review of these changes before proceeding.\"}'; fi",
|
|
30
|
+
"timeout": 10
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
21
36
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-review-code
|
|
3
|
+
description: Get a second-opinion code review from OpenAI Codex CLI (GPT-5.4 xhigh). Use when the user asks for a code review, wants a second pair of eyes, or you want to validate significant changes.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
- Edit
|
|
10
|
+
- Write
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Get an independent code review from OpenAI's Codex CLI using GPT-5.4 with maximum reasoning effort. Codex acts as a principal engineer providing a second opinion. You have more context than Codex — use your own judgment to decide what feedback to incorporate.
|
|
15
|
+
|
|
16
|
+
## Invoking Codex
|
|
17
|
+
|
|
18
|
+
Use `codex exec` to run a one-shot review. Always write output to a temp file for reliable capture.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
TMPFILE=$(mktemp /tmp/codex-review.XXXXXXXX)
|
|
22
|
+
[ -f "$HOME/.codex/.env" ] && . "$HOME/.codex/.env"
|
|
23
|
+
codex exec \
|
|
24
|
+
-m gpt-5.4 \
|
|
25
|
+
-c 'model_reasoning_effort="xhigh"' \
|
|
26
|
+
-s read-only \
|
|
27
|
+
--ephemeral \
|
|
28
|
+
-o "$TMPFILE" \
|
|
29
|
+
"$PROMPT"
|
|
30
|
+
cat "$TMPFILE"
|
|
31
|
+
rm "$TMPFILE"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Flags explained:**
|
|
35
|
+
- `-m gpt-5.4` — model selection (always use this for reviews)
|
|
36
|
+
- `-c 'model_reasoning_effort="xhigh"'` — maximum thinking effort, principal-engineer level
|
|
37
|
+
- `-s read-only` — Codex can read the codebase but cannot modify any files (critical for reviews)
|
|
38
|
+
- `--ephemeral` — no conversation persistence, clean context
|
|
39
|
+
- `-o "$TMPFILE"` — write output to file (avoids noisy stdout metadata)
|
|
40
|
+
|
|
41
|
+
**Critical — temp file creation:** You MUST use `mktemp` exactly as shown above. On macOS, `mktemp` only replaces the X's when they are the **last characters** of the template. Do NOT add a file extension (e.g., `.md`) after the X's — this causes `mktemp` to use the template literally without substitution, creating a file literally named with X's. The template `/tmp/codex-review.XXXXXXXX` (no extension) is correct and must be used verbatim.
|
|
42
|
+
|
|
43
|
+
**Error handling:** If codex returns a non-zero exit code, read stderr for the error message. Report the error to the user and do not retry automatically — there may be an auth or config issue the user needs to resolve.
|
|
44
|
+
|
|
45
|
+
## Telling Codex what to review
|
|
46
|
+
|
|
47
|
+
Codex has shell access — it can run git commands and read files itself. Don't bloat the prompt by embedding diffs or file contents. Instead, tell Codex *what* to do in the prompt and let it retrieve the code.
|
|
48
|
+
|
|
49
|
+
### Git diff (most common — review uncommitted changes)
|
|
50
|
+
Tell Codex to run `git diff` (or `git diff --cached` for staged changes).
|
|
51
|
+
|
|
52
|
+
### Git commit(s)
|
|
53
|
+
Tell Codex the commit hash(es) and to run `git show <hash>` or `git log -p <hash1>..<hash2>`.
|
|
54
|
+
|
|
55
|
+
### Specific files or directory
|
|
56
|
+
Tell Codex the file paths or directory to review and to read them itself.
|
|
57
|
+
|
|
58
|
+
### Scoping the review
|
|
59
|
+
To narrow what Codex reviews, pass the scope in the prompt itself. For example:
|
|
60
|
+
- "Run `git diff -- src/api/routes.py src/api/middleware.py` and review those changes"
|
|
61
|
+
- "Read the files in `src/auth/` and review them"
|
|
62
|
+
- "Run `git show abc1234 -- lib/` and review only the lib changes"
|
|
63
|
+
|
|
64
|
+
Codex handles the filtering — no need to embed content.
|
|
65
|
+
|
|
66
|
+
### Important:
|
|
67
|
+
- Always tell Codex it can run git commands if it needs more context beyond what you asked it to review.
|
|
68
|
+
- Always tell Codex to return an error message (not silently fail) if it cannot access something.
|
|
69
|
+
|
|
70
|
+
## Constructing the prompt
|
|
71
|
+
|
|
72
|
+
The prompt to Codex must include these sections:
|
|
73
|
+
|
|
74
|
+
### 1. Context summary (required)
|
|
75
|
+
A brief summary of what the code changes are for and the goal. This prevents Codex from optimizing for the wrong thing.
|
|
76
|
+
|
|
77
|
+
### 2. What to review (required)
|
|
78
|
+
Tell Codex what to review — a git command to run, file paths to read, or (rarely) embedded code.
|
|
79
|
+
|
|
80
|
+
### 3. Focus areas (optional but recommended)
|
|
81
|
+
If you or the user have specific concerns, list them. Examples: "pay special attention to error handling", "check for SQL injection", "verify the caching logic is correct".
|
|
82
|
+
|
|
83
|
+
### 4. Output format instructions (required)
|
|
84
|
+
Tell Codex exactly how to structure its response:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Return your review as plain text in this format:
|
|
88
|
+
|
|
89
|
+
## Critical Issues
|
|
90
|
+
Issues that must be fixed — bugs, security vulnerabilities, data loss risks.
|
|
91
|
+
List each with: file, line/section, issue description, and what should change.
|
|
92
|
+
If none, write "None found."
|
|
93
|
+
|
|
94
|
+
## Improvements
|
|
95
|
+
Code quality, performance, readability, or maintainability suggestions.
|
|
96
|
+
Tag each with a severity: [high] (real impact on correctness, performance, or security if left), [medium] (meaningful quality improvement), [low] (nitpick or style preference).
|
|
97
|
+
List each with: severity tag, file, line/section, what to improve, and why.
|
|
98
|
+
|
|
99
|
+
Be token-efficient. Use whichever is most concise: a brief description, a function/variable name, a short code snippet, or a one-liner fix. Don't rewrite large blocks of code — describe the change instead.
|
|
100
|
+
|
|
101
|
+
## Positive Notes
|
|
102
|
+
Things done well that should be kept.
|
|
103
|
+
|
|
104
|
+
## Summary
|
|
105
|
+
2-3 sentence overall assessment.
|
|
106
|
+
|
|
107
|
+
Do NOT include metadata, conversation artifacts, or commentary outside this format.
|
|
108
|
+
If you cannot access a file or run a command, say so clearly in your response instead of silently skipping it.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Example full prompt
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
You are reviewing code changes in a git repository. Here is the context:
|
|
115
|
+
|
|
116
|
+
**Goal:** Adding rate limiting middleware to the Express API to prevent abuse of the /api/search endpoint.
|
|
117
|
+
|
|
118
|
+
**Focus areas:** Check that the rate limit configuration is correct, that the middleware ordering is right, and that error responses follow our existing API format.
|
|
119
|
+
|
|
120
|
+
You have access to git and the filesystem. If you need more context, run git commands to explore. If you cannot access something, say so clearly.
|
|
121
|
+
|
|
122
|
+
**What to review:** Run `git diff` to see the uncommitted changes, then review them.
|
|
123
|
+
|
|
124
|
+
Return your review as plain text in this format:
|
|
125
|
+
[... format instructions from above ...]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Processing Codex's response
|
|
129
|
+
|
|
130
|
+
### 1. Read and assess the feedback yourself
|
|
131
|
+
Do NOT blindly apply Codex's suggestions. You have far more context about:
|
|
132
|
+
- The broader codebase and its conventions
|
|
133
|
+
- The user's intent and constraints
|
|
134
|
+
- What has already been tried or discussed
|
|
135
|
+
- Project-specific patterns and trade-offs
|
|
136
|
+
|
|
137
|
+
For each piece of feedback, decide:
|
|
138
|
+
- **Incorporate** — the feedback is correct and valuable
|
|
139
|
+
- **Adapt** — the spirit is right but the specific suggestion needs adjustment for this codebase
|
|
140
|
+
- **Discard** — the feedback is wrong, irrelevant, or conflicts with known constraints
|
|
141
|
+
|
|
142
|
+
### 2. Fix what you can
|
|
143
|
+
If Codex identified real issues that you agree with and can fix, fix them before reporting to the user. Don't make the user do work you can handle.
|
|
144
|
+
|
|
145
|
+
### 3. Report to the user
|
|
146
|
+
Present a clear summary structured as:
|
|
147
|
+
|
|
148
|
+
**Codex Review Summary:**
|
|
149
|
+
- Brief overview of what Codex found
|
|
150
|
+
|
|
151
|
+
**My Assessment:**
|
|
152
|
+
- Which feedback points you're incorporating and why
|
|
153
|
+
- Which you're discarding and why
|
|
154
|
+
- Any points you're unsure about and want the user's input on
|
|
155
|
+
|
|
156
|
+
**Changes Made:**
|
|
157
|
+
- What you fixed based on the review
|
|
158
|
+
- Why those changes improve the code
|
|
159
|
+
|
|
160
|
+
**For Your Decision:**
|
|
161
|
+
- Any feedback points that require the user's judgment (e.g., architectural trade-offs, business logic questions)
|
|
162
|
+
|
|
163
|
+
### 4. If Codex returns errors
|
|
164
|
+
If Codex couldn't complete the review (auth issues, timeout, can't access files):
|
|
165
|
+
- Report the error clearly to the user
|
|
166
|
+
- Do NOT retry automatically
|
|
167
|
+
- Suggest what the user might check (codex auth, file permissions, etc.)
|
|
168
|
+
|
|
169
|
+
## What NOT to do
|
|
170
|
+
|
|
171
|
+
- Do not treat Codex's feedback as authoritative. It is a second pair of eyes, not the final word.
|
|
172
|
+
- Do not call Codex repeatedly in a loop trying to get different answers.
|
|
173
|
+
- Do not send the entire repository — keep reviews focused on the relevant changes.
|
|
174
|
+
- Do not skip your own assessment. The user is relying on your judgment to filter and contextualize Codex's raw feedback.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-review-plan
|
|
3
|
+
description: Send the current plan to OpenAI Codex CLI for iterative review. Claude and Codex go back-and-forth until Codex approves the plan.
|
|
4
|
+
user_invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codex Plan Review (Iterative)
|
|
8
|
+
|
|
9
|
+
Send the current implementation plan to OpenAI Codex for review. Claude revises the plan based on Codex's feedback and re-submits until Codex approves. Max 5 rounds.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## When to Invoke
|
|
14
|
+
|
|
15
|
+
- When the user runs `/codex-review-plan` during or after plan mode
|
|
16
|
+
- When the user wants a second opinion on a plan from a different model
|
|
17
|
+
|
|
18
|
+
## Agent Instructions
|
|
19
|
+
|
|
20
|
+
When invoked, perform the following iterative review loop:
|
|
21
|
+
|
|
22
|
+
### Step 1: Generate Session ID
|
|
23
|
+
|
|
24
|
+
Generate a unique ID to avoid conflicts with other concurrent Claude Code sessions:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use this for all temp file paths: `/tmp/claude-plan-${REVIEW_ID}.md` and `/tmp/codex-review-plan-${REVIEW_ID}.md`.
|
|
31
|
+
|
|
32
|
+
### Step 2: Capture the Plan
|
|
33
|
+
|
|
34
|
+
Write the current plan to the session-scoped temporary file. The plan is whatever implementation plan exists in the current conversation context (from plan mode, or a plan discussed in chat).
|
|
35
|
+
|
|
36
|
+
1. Write the full plan content to `/tmp/claude-plan-${REVIEW_ID}.md`
|
|
37
|
+
2. If there is no plan in the current context, ask the user what they want reviewed
|
|
38
|
+
|
|
39
|
+
### Step 3: Initial Review (Round 1)
|
|
40
|
+
|
|
41
|
+
Run Codex CLI in non-interactive mode to review the plan:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
[ -f "$HOME/.codex/.env" ] && . "$HOME/.codex/.env"
|
|
45
|
+
codex exec \
|
|
46
|
+
-m gpt-5.4 \
|
|
47
|
+
-s read-only \
|
|
48
|
+
-o /tmp/codex-review-plan-${REVIEW_ID}.md \
|
|
49
|
+
"Review the implementation plan in /tmp/claude-plan-${REVIEW_ID}.md. Focus on:
|
|
50
|
+
1. Correctness - Will this plan achieve the stated goals?
|
|
51
|
+
2. Risks - What could go wrong? Edge cases? Data loss?
|
|
52
|
+
3. Missing steps - Is anything forgotten?
|
|
53
|
+
4. Alternatives - Is there a simpler or better approach?
|
|
54
|
+
5. Security - Any security concerns?
|
|
55
|
+
|
|
56
|
+
Be specific and actionable. If the plan is solid and ready to implement, end your review with exactly: VERDICT: APPROVED
|
|
57
|
+
|
|
58
|
+
If changes are needed, end with exactly: VERDICT: REVISE"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Capture the Codex session ID** from the output line that says `session id: <uuid>`. Store this as `CODEX_SESSION_ID`. You MUST use this exact ID to resume in subsequent rounds (do NOT use `--last`, which would grab the wrong session if multiple reviews are running concurrently).
|
|
62
|
+
|
|
63
|
+
**Notes:**
|
|
64
|
+
- Use `-m gpt-5.4` as the default model (configured in `~/.codex/config.toml`). If the user specifies a different model (e.g., `/codex-review-plan o4-mini`), use that instead. Store the resolved model name as `MODEL` and use it in all output headers.
|
|
65
|
+
- Use `-s read-only` so Codex can read the codebase for context but cannot modify anything.
|
|
66
|
+
- Use `-o` to capture the output to a file for reliable reading.
|
|
67
|
+
|
|
68
|
+
### Step 4: Read Review & Check Verdict
|
|
69
|
+
|
|
70
|
+
1. Read `/tmp/codex-review-plan-${REVIEW_ID}.md`
|
|
71
|
+
2. Present Codex's review to the user:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
## Codex Review — Round N (model: ${MODEL})
|
|
75
|
+
|
|
76
|
+
[Codex's feedback here]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. Check the verdict:
|
|
80
|
+
- If **VERDICT: APPROVED** → go to Step 7 (Done)
|
|
81
|
+
- If **VERDICT: REVISE** → go to Step 5 (Revise & Re-submit)
|
|
82
|
+
- If no clear verdict but feedback is all positive / no actionable items → treat as approved
|
|
83
|
+
- If max rounds (5) reached → go to Step 7 with a note that max rounds hit
|
|
84
|
+
|
|
85
|
+
### Step 5: Revise the Plan
|
|
86
|
+
|
|
87
|
+
Based on Codex's feedback:
|
|
88
|
+
|
|
89
|
+
1. **Revise the plan** — address each issue Codex raised. Update the plan content in the conversation context and rewrite `/tmp/claude-plan-${REVIEW_ID}.md` with the revised version.
|
|
90
|
+
2. **Briefly summarize** what you changed for the user:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
### Revisions (Round N)
|
|
94
|
+
- [What was changed and why, one bullet per Codex issue addressed]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
3. Inform the user what's happening: "Sending revised plan back to Codex for re-review..."
|
|
98
|
+
|
|
99
|
+
### Step 6: Re-submit to Codex (Rounds 2-5)
|
|
100
|
+
|
|
101
|
+
Resume the existing Codex session so it has full context of the prior review:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
[ -f "$HOME/.codex/.env" ] && . "$HOME/.codex/.env"
|
|
105
|
+
codex exec resume ${CODEX_SESSION_ID} \
|
|
106
|
+
-o /tmp/codex-review-plan-${REVIEW_ID}.md \
|
|
107
|
+
"I've revised the plan based on your feedback. The updated plan is in /tmp/claude-plan-${REVIEW_ID}.md.
|
|
108
|
+
|
|
109
|
+
Here's what I changed:
|
|
110
|
+
[List the specific changes made]
|
|
111
|
+
|
|
112
|
+
Please re-review. If the plan is now solid and ready to implement, end with: VERDICT: APPROVED
|
|
113
|
+
If more changes are needed, end with: VERDICT: REVISE"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Then go back to **Step 4** (Read Review & Check Verdict).
|
|
117
|
+
|
|
118
|
+
**Important:** If `resume ${CODEX_SESSION_ID}` fails (e.g., session expired), fall back to a fresh `codex exec` call with `-s read-only` and context about the prior rounds included in the prompt. **Capture the new session ID** from the fresh exec output and update `CODEX_SESSION_ID` so subsequent rounds resume from the correct session.
|
|
119
|
+
|
|
120
|
+
**Error handling:** If Codex returns a non-zero exit code or the output file is empty, report the error to the user and do not continue the loop automatically. Check stderr for auth failures, transport errors, or timeout messages.
|
|
121
|
+
|
|
122
|
+
### Step 7: Present Final Result
|
|
123
|
+
|
|
124
|
+
Once approved (or max rounds reached):
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
## Codex Review — Final (model: ${MODEL})
|
|
128
|
+
|
|
129
|
+
**Status:** ✅ Approved after N round(s)
|
|
130
|
+
|
|
131
|
+
[Final Codex feedback / approval message]
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
**The plan has been reviewed and approved by Codex. Ready for your approval to implement.**
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If max rounds were reached without approval:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
## Codex Review — Final (model: ${MODEL})
|
|
141
|
+
|
|
142
|
+
**Status:** ⚠️ Max rounds (5) reached — not fully approved
|
|
143
|
+
|
|
144
|
+
**Remaining concerns:**
|
|
145
|
+
[List unresolved issues from last review]
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
**Codex still has concerns. Review the remaining items and decide whether to proceed or continue refining.**
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Step 8: Cleanup
|
|
152
|
+
|
|
153
|
+
Remove the session-scoped temporary files:
|
|
154
|
+
```bash
|
|
155
|
+
rm -f /tmp/claude-plan-${REVIEW_ID}.md /tmp/codex-review-plan-${REVIEW_ID}.md
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Loop Summary
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Round 1: Claude sends plan → Codex reviews → REVISE?
|
|
162
|
+
Round 2: Claude revises → Codex re-reviews (resume session) → REVISE?
|
|
163
|
+
Round 3: Claude revises → Codex re-reviews (resume session) → APPROVED ✅
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Max 5 rounds. Each round preserves Codex's conversation context via session resume.
|
|
167
|
+
|
|
168
|
+
## Rules
|
|
169
|
+
|
|
170
|
+
- Claude **actively revises the plan** based on Codex feedback between rounds — this is NOT just passing messages, Claude should make real improvements
|
|
171
|
+
- Default model is `gpt-5.4`. Accept model override from the user's arguments (e.g., `/codex-review-plan o4-mini`)
|
|
172
|
+
- Always use read-only sandbox mode — Codex should never write files
|
|
173
|
+
- Max 5 review rounds to prevent infinite loops
|
|
174
|
+
- Show the user each round's feedback and revisions so they can follow along
|
|
175
|
+
- If Codex CLI is not installed or fails, inform the user and suggest `npm install -g @openai/codex`
|
|
176
|
+
- If a revision contradicts the user's explicit requirements, skip that revision and note it for the user
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-usage-check
|
|
3
|
+
description: Check Codex CLI account usage by running `codexbar usage --source cli` and interpreting the output. Use when the user asks about Codex usage, remaining session/weekly quota, reset times, burn rate, pace, or whether Codex is close to running out.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codex Usage Check
|
|
7
|
+
|
|
8
|
+
Use this skill to inspect Codex CLI usage quickly and report the important numbers in plain language.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
Run:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
codexbar usage --source cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Prefer reporting these fields when present:
|
|
19
|
+
- Session remaining percentage
|
|
20
|
+
- Session reset time
|
|
21
|
+
- Weekly remaining percentage
|
|
22
|
+
- Weekly reset time
|
|
23
|
+
- Pace / deficit / expected usage
|
|
24
|
+
- Estimated time until exhaustion
|
|
25
|
+
- Credits remaining
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
1. Run `codexbar usage --source cli`.
|
|
30
|
+
2. Read the output exactly as shown; do not invent missing fields.
|
|
31
|
+
3. Summarize the status in short, user-friendly language.
|
|
32
|
+
4. If the user wants details, include the raw lines or a tighter breakdown.
|
|
33
|
+
|
|
34
|
+
## Interpretation Guide
|
|
35
|
+
|
|
36
|
+
- `Session: 90% left` means the short-term session budget is mostly available.
|
|
37
|
+
- `Weekly: 54% left` means a bit over half of the weekly budget remains.
|
|
38
|
+
- `Pace: 22% in deficit | Expected 24% used` means current consumption is slightly better than the expected burn curve.
|
|
39
|
+
- `Runs out in 2d` is an estimate, not a guarantee.
|
|
40
|
+
- `Credits: 0 left` means no extra credits remain beyond the tracked allowance.
|
|
41
|
+
|
|
42
|
+
## Output Style
|
|
43
|
+
|
|
44
|
+
Default to a concise summary such as:
|
|
45
|
+
|
|
46
|
+
- Session: 90% left, resets in 1h 33m
|
|
47
|
+
- Weekly: 54% left, resets in 5d 7h
|
|
48
|
+
- Pace: 22% under expected burn, estimated exhaustion in 2d
|
|
49
|
+
- Credits: 0 left
|
|
50
|
+
|
|
51
|
+
If the command fails, report the failure briefly and include the error text.
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
|
|
55
|
+
- Use the command output as the source of truth.
|
|
56
|
+
- Do not assume plan type or hard quota limits unless the output states them.
|
|
57
|
+
- If the output format changes, still extract only what is explicitly visible.
|
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Running `npx claude-init` sets up your current directory with:
|
|
|
41
41
|
- `.devcontainer/` - Development container configuration (also added `codex-cli` and `spec-kit`.)
|
|
42
42
|
- `.claude/settings.json` - Claude-specific settings
|
|
43
43
|
- `.claude/commands/` - Custom Claude commands
|
|
44
|
+
- `.claude/skills/` - Reusable skill configurations
|
|
44
45
|
- `.claude/agents/` - Specialized agent configurations
|
|
45
46
|
|
|
46
47
|
### What It Does
|
|
@@ -69,6 +70,13 @@ Running `npx claude-init` sets up your current directory with:
|
|
|
69
70
|
- Answer **Yes** to replace your customized `.md` files with fresh templates (while still adding any missing files)
|
|
70
71
|
- Answer **No** (default) to keep your existing `.md` files and only add missing files
|
|
71
72
|
|
|
73
|
+
#### 🧩 .claude/skills
|
|
74
|
+
- **Interactive prompt**: You'll be asked whether to install `.claude/skills` files
|
|
75
|
+
- Answer **Yes** (default) to install skill files
|
|
76
|
+
- Answer **No** to skip skills entirely
|
|
77
|
+
- **If missing**: Creates complete directory with all skill configurations
|
|
78
|
+
- **If exists**: Skips entirely to preserve your setup
|
|
79
|
+
|
|
72
80
|
#### 🤖 .claude/agents
|
|
73
81
|
- **Interactive prompt**: You'll be asked whether to install `.claude/agents` files
|
|
74
82
|
- Answer **Yes** (default) to install/update agent files
|
|
@@ -90,7 +98,13 @@ When running interactively (in a terminal), `claude-init` will ask you:
|
|
|
90
98
|
- If **Yes**: Replaces existing `.md` files with templates, still adds missing files
|
|
91
99
|
- If **No**: Keeps your existing files, only adds missing files
|
|
92
100
|
|
|
93
|
-
3. **Install .claude/
|
|
101
|
+
3. **Install .claude/skills?**
|
|
102
|
+
- Prompt: `Install .claude/skills files? (Y/n):`
|
|
103
|
+
- Default: **Yes** (installs skills)
|
|
104
|
+
- If **Yes**: Creates skills directory with all skill files
|
|
105
|
+
- If **No**: Skips skills entirely (shown in summary)
|
|
106
|
+
|
|
107
|
+
4. **Install .claude/agents?**
|
|
94
108
|
- Prompt: `Install .claude/agents files? (Y/n):`
|
|
95
109
|
- Default: **Yes** (installs agents)
|
|
96
110
|
- If **Yes**: Installs/updates agents as normal
|
|
@@ -99,6 +113,7 @@ When running interactively (in a terminal), `claude-init` will ask you:
|
|
|
99
113
|
**Non-interactive mode (CI/scripts)**: When `process.stdin.isTTY` is false (e.g., in CI pipelines), prompts are skipped and defaults are used:
|
|
100
114
|
- `.claude/settings.json` is **not** overwritten (preserves custom settings)
|
|
101
115
|
- `.claude/commands/*.md` files are **not** overwritten (preserves customizations)
|
|
116
|
+
- `.claude/skills` **is** installed (matches current behavior)
|
|
102
117
|
- `.claude/agents` **is** installed (matches current behavior)
|
|
103
118
|
|
|
104
119
|
## Example Output
|
|
@@ -109,12 +124,14 @@ When running interactively (in a terminal), `claude-init` will ask you:
|
|
|
109
124
|
🚀 Claude Environment Initializer
|
|
110
125
|
Initializing in: /path/to/your/project
|
|
111
126
|
|
|
127
|
+
Install .claude/skills files? (Y/n): y
|
|
112
128
|
Install .claude/agents files? (Y/n): y
|
|
113
129
|
|
|
114
130
|
✓ Created new CLAUDE.md
|
|
115
131
|
✓ Created .devcontainer directory
|
|
116
132
|
✓ Created .claude/settings.json
|
|
117
133
|
✓ Created .claude/commands with 5 files
|
|
134
|
+
✓ Created .claude/skills directory
|
|
118
135
|
✓ Created .claude/agents with 3 files
|
|
119
136
|
|
|
120
137
|
📊 Summary:
|
|
@@ -131,6 +148,7 @@ Install .claude/agents files? (Y/n): y
|
|
|
131
148
|
Initializing in: /path/to/your/project
|
|
132
149
|
|
|
133
150
|
Overwrite existing .claude/commands/*.md with template versions? (y/N): n
|
|
151
|
+
Install .claude/skills files? (Y/n): n
|
|
134
152
|
Install .claude/agents files? (Y/n): n
|
|
135
153
|
Overwrite existing .claude/settings.json with template version? (y/N): n
|
|
136
154
|
|
|
@@ -144,6 +162,7 @@ Overwrite existing .claude/settings.json with template version? (y/N): n
|
|
|
144
162
|
Updated: 1 items
|
|
145
163
|
Skipped: 3 items (already exist)
|
|
146
164
|
Files added: 1
|
|
165
|
+
- .claude/skills skipped by user
|
|
147
166
|
- .claude/agents skipped by user
|
|
148
167
|
|
|
149
168
|
✅ Claude environment is already up to date!
|
|
@@ -156,9 +175,10 @@ Overwrite existing .claude/settings.json with template version? (y/N): n
|
|
|
156
175
|
Initializing in: /path/to/your/project
|
|
157
176
|
|
|
158
177
|
✓ Created new CLAUDE.md
|
|
159
|
-
✓ Created .devcontainer directory
|
|
178
|
+
✓ Created .devcontainer directory
|
|
160
179
|
✓ Created .claude/settings.json
|
|
161
180
|
↻ Added 2 missing files to .claude/commands (2 files)
|
|
181
|
+
✓ Created .claude/skills directory
|
|
162
182
|
- All files in .claude/agents are up to date
|
|
163
183
|
|
|
164
184
|
📊 Summary:
|
|
@@ -182,6 +202,7 @@ your-project/
|
|
|
182
202
|
└── .claude/
|
|
183
203
|
├── settings.json # Claude settings
|
|
184
204
|
├── commands/ # Custom commands
|
|
205
|
+
├── skills/ # Reusable skills
|
|
185
206
|
└── agents/ # Specialized agents
|
|
186
207
|
```
|
|
187
208
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -83,6 +83,12 @@ export async function cli() {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// Determine if we should install .claude/skills
|
|
87
|
+
const includeSkills = await promptYesNo(
|
|
88
|
+
'Install .claude/skills files?',
|
|
89
|
+
true
|
|
90
|
+
);
|
|
91
|
+
|
|
86
92
|
// Determine if we should install .claude/agents
|
|
87
93
|
const includeAgents = await promptYesNo(
|
|
88
94
|
'Install .claude/agents files?',
|
|
@@ -155,6 +161,14 @@ export async function cli() {
|
|
|
155
161
|
});
|
|
156
162
|
}
|
|
157
163
|
|
|
164
|
+
// Conditionally add .claude/skills task
|
|
165
|
+
if (includeSkills) {
|
|
166
|
+
tasks.push({
|
|
167
|
+
name: '.claude/skills',
|
|
168
|
+
handler: () => handleDirectoryMirror(targetDir, '.claude/skills')
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
158
172
|
// Conditionally add .claude/agents task
|
|
159
173
|
if (includeAgents) {
|
|
160
174
|
tasks.push({
|
|
@@ -208,6 +222,10 @@ export async function cli() {
|
|
|
208
222
|
console.log(chalk.gray(` - devcontainer skipped by user`));
|
|
209
223
|
}
|
|
210
224
|
|
|
225
|
+
if (!includeSkills) {
|
|
226
|
+
console.log(chalk.gray(` - .claude/skills skipped by user`));
|
|
227
|
+
}
|
|
228
|
+
|
|
211
229
|
if (!includeAgents) {
|
|
212
230
|
console.log(chalk.gray(` - .claude/agents skipped by user`));
|
|
213
231
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!codexbar usage --source cli
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!npx -y @steipete/summarize "$ARGUMENTS" --length xl
|