content-factory-grounding-dedup
Skill0 starsChanged 5 months agoMITView on GitHub
LLMコンテンツ生成スクリプトで「個人活動ログによるグラウンディング」と「投稿型/テーマの重複回避ログ」を組み合わせるパターン。generate.sh のような1本起草スクリプトを書くときに使う。
In this repository99 other files it gives its agents.
- agents-tools-quoted-jsonSkill
- asc-api-app-store-submitSkill
- asd-ste100Skill
- automation-bool-selector-pitfallsSkill
- automation-stale-cooldown-flagSkill
- autonomous-build-verifySkill
- book-to-skillSkill
- ccusage-cli-cost-trackingSkill
- chrome-ext-mv3-programmatic-injectSkill
- chrome-ext-store-assetsSkill
- claude-headless-p-invocationSkill
- claude-plugin-context-auditSkill
- claude-session-log-to-kbSkill
- cloudflare-workers-do-deploySkill
- codebase-to-courseSkill
- codesign-keychain-prompt-fixSkill
- codex-cli-setupSkill
- codex-delegation-handoffSkill
- conversation-log-append-patternSkill
- cron-to-launchd-macosSkill
- cross-automation-shared-resource-killSkill
- design-token-migration-rnSkill
- discord-bot-image-to-claudeSkill
- discord-gateway-resume-dedupSkill
- excel-filtered-url-http-auditSkill
- execution-budget-vs-capsSkill
- expo-free-local-ios-testflightSkill
- ga4-connect-projectsSkill
- gcal-oauth-desktop-setupSkill
- git-commit-helperSkill
- git-prepush-secret-remote-checkSkill
- gsc-cli-automationSkill
- hatena-blogsync-autopostSkill
- hook-latency-wrapSkill
- hook-log-append-patternSkill
- html-to-pdf-slide-deckSkill
- humanizerSkill
- human-review-gate-shellSkill
- implementation-model-routingSkill
- insights-to-claude-mdSkill
- ios-permission-key-security-matrixSkill
- ios-sim-store-screenshotsSkill
- launchd-exit78-exconfig-debugSkill
- llm-content-pipeline-quality-gateSkill
- local-ai-video-pipelineSkill
- local-flux-mflux-image-genSkill
- local-llm-slow-diagnosisSkill
- local-music-generationSkill
- lottie-skottie-authoring-pitfallsSkill
- machine-wide-api-ratelimit-latchSkill
- macos-hook-path-timeoutSkill
- md-to-docx-reportSkill
- memory-md-inject-bloat-auditSkill
- message-display-secrets-maskSkill
- metric-source-attributionSkill
- migrate-icloud-desktop-assetsSkill
- nextauth-local-e2e-sessionSkill
- nextjs-rsc-payload-slimSkill
- nothing-designSkill
- openclaw-ollama-setupSkill
- The first 60 shown.
The file
Files
Procedure
1. knowledge/ ディレクトリからプロンプトバンドルを組む
KNOW=""
for f in persona hooks style post-types quality-rubric; do
KNOW+=$'\n\n===== '"$f"$' =====\n'"$(cat "$DIR/knowledge/$f.md")"
done各テーマの markdown ファイルを1変数に結合して後続の PROMPT に埋め込む。 ファイル追加だけでナレッジを拡張できる。
2. 個人活動ログでグラウンディング(一次情報の注入)
GROUND=""
for src in "$HOME/.remember/recent.md" "$HOME/.remember/now.md" \
"$HOME/Documents/claude-obsidian/wiki/hot.md"; do
[ -f "$src" ] && GROUND+=$'\n\n--- '"$(basename "$src")"$' ---\n'"$(head -c 4000 "$src")"
done
[ -z "$GROUND" ] && GROUND="(作業ログ無し。一般的な知見で書く)"head -c 4000でトークン肥大を防ぐ- ファイルが存在しなければフォールバックメッセージを使い、スクリプトを止めない
- プロンプトには「このログから固有名・数字・失敗を必ず拾え」と明示する
3. 直近 N 件の型/テーマを注入して重複を回避
TYPES_LOG="$DIR/logs/posted-types.log"
TOPICS_LOG="$DIR/logs/posted-topics.log"
touch "$TYPES_LOG" "$TOPICS_LOG"
LAST_TYPES=$(tail -3 "$TYPES_LOG" | paste -sd '、' -)
[ -z "$LAST_TYPES" ] && LAST_TYPES="(まだ無し)"
LAST_TOPICS=$(tail -8 "$TOPICS_LOG" | paste -sd '、' -)
[ -z "$LAST_TOPICS" ] && LAST_TOPICS="(まだ無し)"プロンプトに「直近で使った型(これらは避ける)」「直近で扱ったテーマ(焼き直し禁止)」として挿入する。
4. 生成成功後にログへ追記
echo "$TYPE" >> "$TYPES_LOG"
echo "$TOPIC" >> "$TOPICS_LOG"
echo "$(date '+%F %T')\tOK\tavg=$AVG\t$TYPE\t$TOPIC\t$FNAME" >> "$DIR/logs/gen.log"追記専用(上書きしない)にすることで tail -N が常に正しい直近 N 件を返す。
5. ディレクトリ構成
<factory-dir>/
├── daily.sh # launchd ラッパー(N本まとめ起草)
├── generate.sh # 1本起草(本体)
├── review-gate.sh # 人間チェックゲート(別スキル human-review-gate-shell)
├── PAUSED # このファイルが存在したら全スクリプトが早期 exit 0
├── knowledge/
│ ├── persona.md
│ ├── hooks.md
│ ├── style.md
│ ├── post-types.md
│ └── quality-rubric.md
├── drafts/ # 未レビュー下書き
├── approved/ # 承認済み(投稿待ち)
├── rejected/ # 却下
└── logs/
├── gen.log # タイムスタンプ付き全記録
├── posted-types.log
└── posted-topics.logPitfalls
- ログが存在しない初回 は
touchを忘れるとtailがエラーで止まる。必ずtouch "$TYPES_LOG" "$TOPICS_LOG"を先に実行する。 - グラウンディングの文字数制限 を入れないと長い hot.md がトークンを食い尽くす。
head -c 4000程度の上限を各ファイルに付ける。 - PAUSED ファイルのチェック は generate.sh の先頭と daily.sh の先頭の両方に入れる。どちらか片方だけでは一括バッチが止まらない。
paste -sd '、' -はファイルが空のとき空文字を返す。空ガードを必ず[ -z "$LAST_TYPES" ] && LAST_TYPES="(まだ無し)"で追加する。- posted-types.log / posted-topics.log に書くのは 成功確定後だけ。品質ゲート棄却時に書くと正常な型が「使用済み」扱いになってローテーションが壊れる。
Verification
# 1. ログが正しく追記されているか
tail -5 logs/posted-types.log
tail -5 logs/posted-topics.log
tail -3 logs/gen.log
# 2. PAUSED 制御が効くか
touch PAUSED && bash generate.sh # "[gen] PAUSED" が出ること
rm PAUSED
# 3. grounding が空でもスクリプトが止まらないか
X_ARTICLE_TEST_RESPONSE="TYPE: test\nTOPIC: テスト\nSCORE: {\"avg\":8.0}\n# タイトル\n本文" \
bash generate.sh
ls drafts/ # ファイルが1本生成されること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
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.

