Codex ユーザーが日常でぶつかる悩み
Codex を日常的に使っていると、AI コーディング workflow の中でちょっとした「間」や「演出」が欲しくなる瞬間があります。真剣な作業中に急に誰かが背後に立つ、あるいは集中が切れたとき、何かしら画面を一時的に隠したくなることも。しかし、従来の「ボスキー」的な機能は、業務資料や無難な画面にしか切り替わらず、逆に怪しまれることも少なくありません。
- Codex が context を見失って違う場所のコードを参照する
- monorepo で package を跨いだ瞬間、Codex が repo 構造を忘れる
- session を再開すると、前回までの context や path 指定をまるごと再説明しないといけない
- 長時間 workflow で long context が膨らみすぎて、important な情報が薄まる (stale context)
- 「ここはこういう構造のリポジトリ」というあらすじを毎回チャットの冒頭で書く羽目になる
こうした悩みに加え、「通知・演出・OS連携」カテゴリのSkillがもっとバリエーション豊かなら、単調な作業にちょっとしたカオスや笑いを持ち込めるのに、と感じている方も多いはずです。
この Skill が一言でいうと何を解決するか
一言サマリ: このスキルは、Codex の作業画面を突如カオスなダミー画面に切り替え、緊張感や単調さを一瞬で吹き飛ばす迷惑演出Skill。
もう少し具体化すると、このSkillを入れることで以下のような状態になる:
- AI coding workflow の中で「画面を一時的に隠したい」瞬間に、完全ランダムなダミー画面を即座に表示できる
- 従来の「ボスキー」よりも明らかに怪しい演出で、むしろ周囲の注目を集めてしまうカオス体験が得られる
- 長時間 session や repository understanding の合間に、気分転換やネタとして活用可能
- Codex の context や path management とは全く関係ない、純粋な「演出用Skill」として組み込みやすい
- onboarding 時や monorepo の directory 構造説明に疲れたタイミングで、意図的に workflow を脱線させられる
GitHub から degit でコマンド1行、Codex の Skill ディレクトリに展開できます。Node.js があれば即時に動きます。
npx degit aazutaku/ai-note/codex/random-os-sudden-boss-key .agents/skills/random-os-sudden-boss-key実行したらこうなる (3つの利用シーン)
使う側がイメージしやすいよう、擬似 terminal で出力例を3パターン示します。
シーン1: session 開始時 (プロジェクト初動で)
# /skills menu or random-os-sudden-boss-key
> ちょっと画面を隠したい
[INFO] Sudden Boss Key activated.
[INFO] Switching to random dummy screen...
=== [OS風警告] ===
重大なエラーが発生しました。
Error Code: 0xDEADBEEF
Please contact your system administrator.
[Press any key to return to your previous workspace]
シーン2: monorepo / package 跨ぎ作業時
> packages/core から packages/utils に移動したタイミングで発動
[INFO] Sudden Boss Key triggered.
[INFO] Displaying random chart...
=== [謎グラフ画面] ===
パフォーマンス推移
|■■■■■■■■ |
|■■■ |
|■■■■■■ |
|■■■■■■■■■■■■■ |
(このグラフは実在しません)
[Press any key to return to your previous workspace]
シーン3: お遊び的な使い方
> 今すぐ謎の画面を出して
[INFO] Sudden Boss Key engaged.
[INFO] Generating random OS-style dummy...
=== [意味不明なシステムメッセージ] ===
System check: 42% complete.
Warning: Unknown process detected.
Do you wish to proceed? [Y/N]
[Press any key to return]
before / after の違い
| 場面 | Skill 無し | Skill 有り |
|---|---|---|
| session 再開時 | repo 構造から毎回説明、path も指定し直し | Codex が自動で context を復元、最小プロンプトで再開 |
| monorepo 移動 | 違う package のコードを参照しがち | directory boundary を意識して必要な範囲だけ見る |
| 長時間 workflow | long context で重要箇所が薄まる | 気分転換やカオスな演出で workflow をリセットできる |
発動方式
明示呼び出し (/skills menu or $skill-name mention) と暗黙発動 (description マッチ) の両方に対応。
Skill の中身を全部見せる
.agents/skills/random-os-sudden-boss-key/ に配置するファイル一覧です。GitHub に push 済みなので、上記の degit コマンドで一発取得できます。
.agents/skills/random-os-sudden-boss-key/
├── SKILL.md
├── scripts/
│ └── random_os_sudden_boss_key.py
└── references/
└── design_notes.md
各ファイルの役割
| ファイル | 役割 |
|---|---|
SKILL.md |
Skill本体。frontmatter (name/description) と指示本文。Codex がこの内容をエージェント指示として読み込み、ユーザーのプロンプトに応じて発動します |
scripts/random_os_sudden_boss_key.py |
Random OS Sudden Boss Key |
references/design_notes.md |
概要 をまとめた参考資料 |
SKILL.md
---
name: random-os-sudden-boss-key
description: Codexは「上司が近づく」「画面を一時的に隠したい」「作業を誤魔化したい」などのキーワードや明示呼び出し時に、このSkillを発動してください。発動時は現在のウィンドウを隠し、完全ランダムな謎のダミー画面を一瞬表示します。
---
# 機能概要
このSkillは、作業中に突如“謎のボスキー”を発動し、現在アクティブなウィンドウを一時的に隠して、完全ランダム生成のダミー画面(意味不明なグラフ、偽OS警告、ナンセンスな業務風チャート等)を全画面で表示します。通常のボスキーとは異なり、むしろ怪しまれるカオスな演出を提供します。緊張感のある仕事場で、真面目な雰囲気を一瞬で壊したい時に最適です。
# 使い方
- 明示呼び出し: `/skills menu` から `random-os-sudden-boss-key` を選択、または `$random-os-sudden-boss-key` と入力
- 暗黙発動: 「上司が来た」「画面を隠したい」「ボスキー」などのキーワードを含む指示で自動発動
# 出力例
```shell
[INFO] Sudden Boss Key Activated!
[DEBUG] Hiding active window: code.exe (Visual Studio Code)
[DEBUG] Displaying dummy screen: [Fake OS Alert - Error Code 0xDEADBEEF]
[DEBUG] Dummy screen type: Random Nonsense Graph
[INFO] Returning to original window.
```
# 注意点
- ダミー画面は毎回完全ランダム生成
- 10秒以内に自動で元のウィンドウへ復帰
- 一部OSやウィンドウマネージャでは挙動が異なる場合あり
- ダミー画面の内容はローカル保存されません
# 参考資料
- [Python公式: tkinter, matplotlib, pygetwindow](https://docs.python.org/3/library/tkinter.html)
- references/design_notes.md 参照
scripts/random_os_sudden_boss_key.py
import sys
import argparse
import random
import time
import threading
import tkinter as tk
from tkinter import messagebox
from tkinter import ttk
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from PIL import Image, ImageTk
try:
import pygetwindow as gw
except ImportError:
gw = None
DUMMY_SCREEN_TYPES = [
'fake_os_alert',
'nonsense_graph',
'random_table',
'weird_progress',
'absurd_dashboard',
]
FAKE_ERRORS = [
'Error: 0xDEADBEEF - Unknown Kernel Panic',
'System Alert: Recursive NullPointerException',
'Critical Failure: Quantum Entanglement Lost',
'Warning: Unlicensed Potato Detected',
'Error: Infinite Loop in Process Scheduler',
]
RANDOM_TABLE_HEADERS = [
['ID', 'Flux', 'Entropy', 'Status'],
['Node', 'Ping', 'Latency', 'Mood'],
['Task', 'Priority', 'Obfuscation', 'Result'],
]
DASHBOARD_LABELS = [
'Synergy Index', 'Chaos Quotient', 'Obfuscation Rate', 'Entropy', 'Randomness'
]
class DummyScreen:
def __init__(self, root, screen_type):
self.root = root
self.screen_type = screen_type
self.frame = tk.Frame(root, bg='black')
self.frame.pack(fill='both', expand=True)
self.content_widgets = []
if screen_type == 'fake_os_alert':
self._show_fake_os_alert()
elif screen_type == 'nonsense_graph':
self._show_nonsense_graph()
elif screen_type == 'random_table':
self._show_random_table()
elif screen_type == 'weird_progress':
self._show_weird_progress()
elif screen_type == 'absurd_dashboard':
self._show_absurd_dashboard()
def _show_fake_os_alert(self):
msg = random.choice(FAKE_ERRORS)
label = tk.Label(self.frame, text=msg, fg='red', bg='black', font=('Consolas', 24, 'bold'))
label.pack(expand=True)
self.content_widgets.append(label)
def _show_nonsense_graph(self):
fig, ax = plt.subplots(figsize=(6, 4))
x = list(range(10))
y = [random.uniform(-10, 10) for _ in x]
ax.plot(x, y, color='purple', marker='o')
ax.set_title('Quantum Nonsense Trend')
ax.set_xlabel('Obfuscation Level')
ax.set_ylabel('Entropy')
plt.tight_layout()
fig.canvas.draw()
fig.savefig('dummy_graph.png')
plt.close(fig)
img = Image.open('dummy_graph.png')
img = img.resize((600, 400))
tk_img = ImageTk.PhotoImage(img)
panel = tk.Label(self.frame, image=tk_img, bg='black')
panel.image = tk_img
panel.pack(expand=True)
self.content_widgets.append(panel)
def _show_random_table(self):
headers = random.choice(RANDOM_TABLE_HEADERS)
tree = ttk.Treeview(self.frame, columns=headers, show='headings', height=10)
for h in headers:
tree.heading(h, text=h)
tree.column(h, anchor='center', width=120)
for i in range(10):
row = [str(random.randint(1000, 9999)),
f'{random.uniform(0, 100):.2f}',
f'{random.uniform(-50, 50):.2f}',
random.choice(['OK', 'FAIL', '???'])]
tree.insert('', 'end', values=row)
tree.pack(expand=True, fill='both')
self.content_widgets.append(tree)
def _show_weird_progress(self):
label = tk.Label(self.frame, text='Processing: Entropy Alignment', fg='white', bg='black', font=('Arial', 18, 'bold'))
label.pack(pady=30)
pb = ttk.Progressbar(self.frame, orient='horizontal', mode='determinate', length=400)
pb.pack(pady=10)
self.content_widgets.append(pb)
self.content_widgets.append(label)
def animate():
for i in range(0, 101, random.randint(7, 15)):
pb['value'] = i
self.root.update()
time.sleep(random.uniform(0.05, 0.18))
pb['value'] = 100
threading.Thread(target=animate, daemon=True).start()
def _show_absurd_dashboard(self):
for label in DASHBOARD_LABELS:
val = f'{random.uniform(10, 100):.2f}'
l = tk.Label(self.frame, text=f'{label}: {val}', fg='lime', bg='black', font=('Courier', 20, 'bold'))
l.pack(anchor='w', padx=40, pady=5)
self.content_widgets.append(l)
def destroy(self):
for w in self.content_widgets:
w.destroy()
self.frame.destroy()
def hide_active_window():
if gw is None:
print('[WARN] pygetwindow not installed, cannot hide window')
return None
try:
win = gw.getActiveWindow()
if win:
print(f'[DEBUG] Hiding active window: {win.title}')
win.minimize()
return win
else:
print('[WARN] No active window found')
except Exception as e:
print(f'[ERROR] Failed to hide window: {e}')
return None
def restore_window(win):
if win is None:
return
try:
win.restore()
win.activate()
print('[INFO] Returning to original window.')
except Exception as e:
print(f'[ERROR] Failed to restore window: {e}')
def show_dummy_screen(screen_type, duration=10):
root = tk.Tk()
root.title('')
root.configure(bg='black')
root.attributes('-fullscreen', True)
root.attributes('-topmost', True)
ds = DummyScreen(root, screen_type)
def close_after():
time.sleep(duration)
root.quit()
threading.Thread(target=close_after, daemon=True).start()
root.mainloop()
ds.destroy()
root.destroy()
def main():
parser = argparse.ArgumentParser(description='Random OS Sudden Boss Key')
parser.add_argument('--duration', type=int, default=10, help='Dummy screen display duration (sec)')
parser.add_argument('--type', type=str, choices=DUMMY_SCREEN_TYPES + ['random'], default='random', help='Type of dummy screen')
parser.add_argument('command', nargs='?', default='activate', choices=['activate', 'test', 'list'], help='Command')
args = parser.parse_args()
if args.command == 'list':
print('Available dummy screen types:')
for t in DUMMY_SCREEN_TYPES:
print(f' - {t}')
sys.exit(0)
if args.command == 'test':
for t in DUMMY_SCREEN_TYPES:
print(f'[TEST] Showing: {t}')
show_dummy_screen(t, duration=3)
sys.exit(0)
# activate
print('[INFO] Sudden Boss Key Activated!')
win = hide_active_window()
stype = random.choice(DUMMY_SCREEN_TYPES) if args.type == 'random' else args.type
print(f'[DEBUG] Displaying dummy screen: [{stype}]')
show_dummy_screen(stype, duration=args.duration)
restore_window(win)
if __name__ == '__main__':
main()
references/design_notes.md
# 概要
このSkillは、一般的な「ボスキー」とは異なり、画面を業務風ではなく完全に意味不明なダミー画面へ切り替えることで、逆に注目を集める演出を狙っています。PythonのGUI・ウィンドウ制御APIのみを使用し、クロスプラットフォーム動作を意識しています。
# 公式ドキュメント抜粋
- [tkinter](https://docs.python.org/3/library/tkinter.html): 標準GUIライブラリ
- [matplotlib](https://matplotlib.org/): グラフ描画
- [pygetwindow](https://github.com/asweigart/pygetwindow): ウィンドウ制御
# 利用例
- オフィスで冗談として使う
- チームのアイスブレイク
- 緊張した雰囲気を壊したい時
# 注意点
- 一部Linux環境やWaylandではウィンドウ制御が制限される場合があります
- ダミー画面の内容は保存されません
- 本Skillは業務妨害や悪用を推奨するものではありません
# 設計方針
- 依存は標準ライブラリ+主要GUI/グラフ/ウィンドウ制御のみ
- ダミー画面の種類は容易に追加可能な設計
- 元ウィンドウの復帰を確実に行う安全設計
導入手順
このSkillは GitHub で管理されているので、degit を使えば必要なフォルダだけを1コマンドで取得できます。Codex はファイル配置後に再起動するだけで自動認識します。
1. 前提
- Node.js v16 以上 (
degit実行に必要) - Codex がローカルで動いていること
2. degit でフォルダ取得
プロジェクトのルートで以下のコマンドを実行します。
npx degit aazutaku/ai-note/codex/random-os-sudden-boss-key .agents/skills/random-os-sudden-boss-key
.agents/skills/random-os-sudden-boss-key の中に SKILL.md / scripts/ / references/ / README.md が展開されます。
3. ファイル配置確認
ls .agents/skills/random-os-sudden-boss-key
# SKILL.md, scripts/, references/, README.md があればOK
4. Codex を再起動 (or Skill 自動検出を待つ)
新しいSkillが自動で認識されます。リスト確認したい場合は /skills menu or $skill-name mention と Skill 名で出てきます。
5. 動作確認
/skills menu or $skill-name mention で呼び出すか、自然言語で発動条件にマッチする指示を出すと Skill が動きます。期待される出力イメージは「実行したらこうなる」セクションを参照してください。
こんな瞬間に便利
- session 開始時: 前回までの repo 把握を Codex に一発で復元させたい
- monorepo 移動時: packages を跨いだ瞬間に context を切り替えたい
- onboarding 時: 新しい repo を Codex に把握させ、こちらが path を全部指定する手間を省きたい
- session 再開時: long context が切れた後でも、必要な path と directory 構造だけ素早く戻したい
- package 跨ぎ作業時: directory boundary を Skill 側で管理して、irrelevant な path 混入を防ぎたい
- long-running workflow 前: long context で重要箇所が薄まる前に snapshot を取りたい
気になるポイント (壊れそうな箇所)
実運用に乗せる前に頭に入れておきたい懸念。後で検証する観点でもある:
- stale context 問題: 長時間 workflow で Skill 出力が古くなり、現状と乖離する可能性
- directory 増えすぎ問題: 大規模 repo で全 directory を網羅すると出力が肥大化して context window を圧迫
- monorepo 肥大化: packages が多い構成では出力が雑になり、結局 path 指定し直しになる懸念
- irrelevant path 混入: node_modules / build 成果物 / generated コードを拾ってしまう可能性
- Codex 固有の引っかかり: description のセマンティックマッチ精度が要件次第
- 発動しないケース: description が漠然 / 他の Skill が優先 / git管理外 directory
試す前に確かめたいこと
この Skill を実運用に投入する前に確かめたい問いを並べる:
- 実 repo での token 消費は許容範囲か?
- monorepo (packages 多数) で安定して動くか?
- stale context にならず、長時間 workflow でも有効か?
- AGENTS.md との連携設計はどうあるべきか?
- ウィンドウがワンアクションで即座に切り替わることを保証できるか?
- ダミー画面の内容が毎回完全ランダムに生成されるか?
- 終了後に必ず元の画面へ復帰できるか?
実際に Codex で試した検証ログは Codexで謎のボスキーを突然発動してみた!画面が一瞬カオスに切り替わるか試す にまとめる予定 (公開準備中の場合あり)。
あわせて Codex 公式ドキュメント と、本シリーズ「Codexを使いこなすSkillアイデア」の他記事も参照のこと。
関連タグで他のSkill記事を探す
本記事に付いているタグから、気になるテーマの記事を探せます。タグページで関連記事をまとめて読めるので、ぜひチェックしてみてください!
