Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ Change history for claude-code-harness.

### Changed

#### session-log.md の分割警告が、動かせるエントリが 1 件も無い状態でも出続けていた問題

**今まで**: `session-log.md` の分割警告は 500 行で出ます。一方、`/maintenance` が実際に退避できるのは「直近 30 日より古いエントリ」だけです。この 2 つが噛み合っておらず、**全エントリが 30 日以内に収まっていると、警告は出るのに移動対象が 1 件も無い**状態になります。当リポジトリでは 520 行 / 全 20 エントリが 30 日以内という、まさにその状態で警告が出続けていました。行数だけを見て退避すると保持ルール違反になるため、警告に従うと規約を破ることになります。

**今後**: 上限を 600 行へ引き上げました。上限は読みやすさの目安であり、保持期間 30 日のように守りの強さを持つ値ではないため、噛み合わない箇所は上限側で解消します。保持期間は直近の作業履歴を本体に残す下限として 30 日のまま維持します。判断の根拠は `skills/maintenance/references/cleanup.md` の閾値表に注記として残しました。

| 項目 | 変更前 | 変更後 |
|---|---|---|
| `SESSION_LOG_MAX_LINES` の既定値 | 500 | 600 |
| 520 行時点の挙動 | 警告あり (移動対象は 0 件) | 警告なし |
| 601 行時点の挙動 | 警告あり | 警告あり (`limit: 600` と表示) |
| 保持期間 | 30 日 | 30 日 (変更なし) |

環境変数 `SESSION_LOG_MAX_LINES` による上書きは従来どおり有効です。定義は Go 実装・`scripts/auto-cleanup-hook.sh`・`templates/hooks/auto-cleanup-hook.sh`・閾値表の 4 箇所にあり、すべて同時に更新しています。稼働している hook は Go 実装 (`bin/harness hook auto-cleanup`) のため、4 プラットフォームのバイナリを再生成しました。

---

依存関係を更新しました。Go 側の 2 件は、同梱バイナリがソースと依存から byte 単位で再現できることを検証する drift gate があるため、bump と同じ変更で 4 プラットフォームのバイナリを再生成しています。

| 依存 | 変更 | 備考 |
Expand Down
Binary file modified bin/harness-darwin-amd64
Binary file not shown.
Binary file modified bin/harness-darwin-arm64
Binary file not shown.
Binary file modified bin/harness-linux-amd64
Binary file not shown.
Binary file modified bin/harness-windows-amd64.exe
Binary file not shown.
16 changes: 14 additions & 2 deletions codex/.codex/skills/maintenance/references/cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
| 変数 | デフォルト | 参照元 |
|------|---------|-------|
| `PLANS_MAX_LINES` | 200 | `scripts/auto-cleanup-hook.sh` |
| `SESSION_LOG_MAX_LINES` | 500 | 同上 |
| `SESSION_LOG_MAX_LINES` | 600 | 同上 |
| `CLAUDE_MD_MAX_LINES` | 100 | 同上 |
| `ARCHIVE_AFTER_DAYS` | 7 | Plans.md 完了タスクの年齢閾値 |
| `LOGS_RETAIN_DAYS` | 30 | `.claude/logs/` の保持日数 |

ユーザーが自由記述で別の閾値を指定したらそちらを優先。

> **`SESSION_LOG_MAX_LINES` と保持期間の関係** (2026-08-08 に 500 → 600 へ引き上げ):
> 分割で実際に動かせるのは「直近 30 日より古いエントリ」だけなので、
> 全エントリが 30 日以内に収まっている間は、行数が上限を超えても**移動対象はゼロ**になる。
> 上限は読みやすさの目安であって守りの強さではないため、この不一致は上限側を上げて解消する。
> 保持期間 30 日は、直近の作業履歴を本体に残すための下限として維持する。

---

## plans — Plans.md アーカイブ
Expand Down Expand Up @@ -71,7 +77,13 @@ grep -c '\[x\].*pm:確認済\|cursor:確認済' "$PLANS" || true

## session-log — session-log.md 月別分割

対象は `.claude/memory/session-log.md`。500行超で分割推奨。
対象は `.claude/memory/session-log.md`。600行超で分割推奨(`SESSION_LOG_MAX_LINES`)。

> **既知の限界**: この警告は行数だけを見ており、退避条件(直近 30 日より古いこと)を満たすエントリが
> 実際に存在するかは判定していない。したがって 600 行を超えていても、全エントリが 30 日以内なら
> 移動対象は 0 件になりうる。上限の引き上げはこの不一致が起きる位置をずらすだけで、種類としては
> 残る。恒久的に解消するには、警告の発火条件自体を「退避可能なエントリが 1 件以上ある」に
> 変更する必要がある(未実施)。上限超過の警告が出たら、まず退避対象の有無を確認すること。

### 手順

Expand Down
2 changes: 1 addition & 1 deletion go/internal/hookhandler/auto_cleanup_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type AutoCleanupHandler struct {

const (
defaultPlansMaxLines = 200
defaultSessionLogMaxLines = 500
defaultSessionLogMaxLines = 600

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check for archivable entries before warning

Raising this constant only hides the reported mismatch for the current 520-line file; a session log with 601 or more lines whose entries are all less than 30 days old still triggers checkSessionLog, while /maintenance is required to retain every entry. The same persistent, unactionable warning therefore returns under a sufficiently active 30-day period. Base the warning on the presence of at least one archivable entry, rather than moving the line-only cutoff.

Useful? React with 👍 / 👎.

defaultClaudeMdMaxLines = 100
)

Expand Down
16 changes: 14 additions & 2 deletions opencode/skills/maintenance/references/cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
| 変数 | デフォルト | 参照元 |
|------|---------|-------|
| `PLANS_MAX_LINES` | 200 | `scripts/auto-cleanup-hook.sh` |
| `SESSION_LOG_MAX_LINES` | 500 | 同上 |
| `SESSION_LOG_MAX_LINES` | 600 | 同上 |
| `CLAUDE_MD_MAX_LINES` | 100 | 同上 |
| `ARCHIVE_AFTER_DAYS` | 7 | Plans.md 完了タスクの年齢閾値 |
| `LOGS_RETAIN_DAYS` | 30 | `.claude/logs/` の保持日数 |

ユーザーが自由記述で別の閾値を指定したらそちらを優先。

> **`SESSION_LOG_MAX_LINES` と保持期間の関係** (2026-08-08 に 500 → 600 へ引き上げ):
> 分割で実際に動かせるのは「直近 30 日より古いエントリ」だけなので、
> 全エントリが 30 日以内に収まっている間は、行数が上限を超えても**移動対象はゼロ**になる。
> 上限は読みやすさの目安であって守りの強さではないため、この不一致は上限側を上げて解消する。
> 保持期間 30 日は、直近の作業履歴を本体に残すための下限として維持する。

---

## plans — Plans.md アーカイブ
Expand Down Expand Up @@ -71,7 +77,13 @@ grep -c '\[x\].*pm:確認済\|cursor:確認済' "$PLANS" || true

## session-log — session-log.md 月別分割

対象は `.claude/memory/session-log.md`。500行超で分割推奨。
対象は `.claude/memory/session-log.md`。600行超で分割推奨(`SESSION_LOG_MAX_LINES`)。

> **既知の限界**: この警告は行数だけを見ており、退避条件(直近 30 日より古いこと)を満たすエントリが
> 実際に存在するかは判定していない。したがって 600 行を超えていても、全エントリが 30 日以内なら
> 移動対象は 0 件になりうる。上限の引き上げはこの不一致が起きる位置をずらすだけで、種類としては
> 残る。恒久的に解消するには、警告の発火条件自体を「退避可能なエントリが 1 件以上ある」に
> 変更する必要がある(未実施)。上限超過の警告が出たら、まず退避対象の有無を確認すること。

### 手順

Expand Down
2 changes: 1 addition & 1 deletion scripts/auto-cleanup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi

# デフォルト閾値
PLANS_MAX_LINES=${PLANS_MAX_LINES:-200}
SESSION_LOG_MAX_LINES=${SESSION_LOG_MAX_LINES:-500}
SESSION_LOG_MAX_LINES=${SESSION_LOG_MAX_LINES:-600}
CLAUDE_MD_MAX_LINES=${CLAUDE_MD_MAX_LINES:-100}

# フィードバックを格納する変数
Expand Down
16 changes: 14 additions & 2 deletions skills/maintenance/references/cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
| 変数 | デフォルト | 参照元 |
|------|---------|-------|
| `PLANS_MAX_LINES` | 200 | `scripts/auto-cleanup-hook.sh` |
| `SESSION_LOG_MAX_LINES` | 500 | 同上 |
| `SESSION_LOG_MAX_LINES` | 600 | 同上 |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the session-log instructions to the new threshold

The threshold table now says 600, but the session-log section in this same reference still says splitting is recommended above 500 lines (line 80). Since the maintenance skill explicitly loads this file for its thresholds and procedure, users handling a 501–600-line log receive contradictory guidance and can encounter the exact no-op cleanup scenario this change intends to eliminate. Update that prose, along with the Codex and OpenCode mirrors, to 600.

Useful? React with 👍 / 👎.

| `CLAUDE_MD_MAX_LINES` | 100 | 同上 |
| `ARCHIVE_AFTER_DAYS` | 7 | Plans.md 完了タスクの年齢閾値 |
| `LOGS_RETAIN_DAYS` | 30 | `.claude/logs/` の保持日数 |

ユーザーが自由記述で別の閾値を指定したらそちらを優先。

> **`SESSION_LOG_MAX_LINES` と保持期間の関係** (2026-08-08 に 500 → 600 へ引き上げ):
> 分割で実際に動かせるのは「直近 30 日より古いエントリ」だけなので、
> 全エントリが 30 日以内に収まっている間は、行数が上限を超えても**移動対象はゼロ**になる。
> 上限は読みやすさの目安であって守りの強さではないため、この不一致は上限側を上げて解消する。
> 保持期間 30 日は、直近の作業履歴を本体に残すための下限として維持する。

---

## plans — Plans.md アーカイブ
Expand Down Expand Up @@ -71,7 +77,13 @@ grep -c '\[x\].*pm:確認済\|cursor:確認済' "$PLANS" || true

## session-log — session-log.md 月別分割

対象は `.claude/memory/session-log.md`。500行超で分割推奨。
対象は `.claude/memory/session-log.md`。600行超で分割推奨(`SESSION_LOG_MAX_LINES`)。

> **既知の限界**: この警告は行数だけを見ており、退避条件(直近 30 日より古いこと)を満たすエントリが
> 実際に存在するかは判定していない。したがって 600 行を超えていても、全エントリが 30 日以内なら
> 移動対象は 0 件になりうる。上限の引き上げはこの不一致が起きる位置をずらすだけで、種類としては
> 残る。恒久的に解消するには、警告の発火条件自体を「退避可能なエントリが 1 件以上ある」に
> 変更する必要がある(未実施)。上限超過の警告が出たら、まず退避対象の有無を確認すること。

### 手順

Expand Down
2 changes: 1 addition & 1 deletion templates/hooks/auto-cleanup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# デフォルト閾値
PLANS_MAX_LINES=${PLANS_MAX_LINES:-200}
SESSION_LOG_MAX_LINES=${SESSION_LOG_MAX_LINES:-500}
SESSION_LOG_MAX_LINES=${SESSION_LOG_MAX_LINES:-600}
CLAUDE_MD_MAX_LINES=${CLAUDE_MD_MAX_LINES:-100}

# 設定ファイルがあれば読み込み
Expand Down