Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
65da17b
test: cover Claude transcript identity and producer conformance
Trecek Oct 26, 2026
e0cb643
fix: align Claude transcript paths and exclude archived sessions
Trecek Oct 26, 2026
fd33ab6
fix: recognize native Claude log resolution in skill capabilities
Trecek Oct 26, 2026
3cf5d4c
docs: retain audit friction working-directory anchor
Trecek Oct 26, 2026
e868eac
test: preserve marker fixture topology and log-mining cwd anchors
Trecek Oct 26, 2026
b9c431e
test: align dotted caller with trusted exploration context
Trecek Oct 26, 2026
41a23ac
fix(review): invalidate probe caches for resources and dependencies
Trecek Oct 26, 2026
42b53cf
refactor(review): compute each probe cache key once
Trecek Oct 26, 2026
8beabc3
fix(review): normalize project paths before locating Claude logs
Trecek Oct 26, 2026
fb1dc7f
refactor(review): share Claude transcript filename filtering
Trecek Oct 26, 2026
4010181
fix(review): match native Claude project path encoding
Trecek Oct 26, 2026
f148ad8
fix(review): exclude orphaned copies from history mining
Trecek Oct 26, 2026
1fa332f
fix(review): resolve setup history paths through tool cwd
Trecek Oct 26, 2026
1221b05
test(review): require physical cwd in Claude history mining
Trecek Oct 26, 2026
bd8fc53
refactor(review): expose session monitor results through process facade
Trecek Oct 26, 2026
18ea06f
fix(review): preserve probe failures when evidence writes fail
Trecek Oct 26, 2026
d7eac32
style(review): annotate the transcript probe result
Trecek Oct 26, 2026
96b701b
test(review): remove the assigned-value probe assertion
Trecek Oct 26, 2026
e44ceba
fix(review): update the process facade export contract
Trecek Oct 26, 2026
27d4208
fix(review): preserve native UTF-16 project slug behavior
Trecek Oct 26, 2026
81f954f
fix(review): exclude generated bytecode from probe cache inputs
Trecek Oct 26, 2026
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
20 changes: 16 additions & 4 deletions .github/workflows/conformance-probes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,18 @@ jobs:
POLICY_IDENTITY=$(.venv/bin/python -c 'from autoskillit.execution.backends._probe_cache import PROBE_POLICY_IDENTITY; print(PROBE_POLICY_IDENTITY)')
echo "policy_identity=${POLICY_IDENTITY}" >> "$GITHUB_OUTPUT"

- name: Resolve probe cache key
id: resolve-cache-key
env:
PROBE_CACHE_KEY: probe-codex-${{ steps.resolve-version.outputs.cli_version }}-${{ steps.resolve-policy.outputs.policy_identity }}-${{ runner.os }}-${{ hashFiles('src/autoskillit/**', 'tests/**', '.autoskillit/recipes/**', 'pyproject.toml', 'uv.lock', '.github/workflows/conformance-probes.yml', '!**/__pycache__/**') }}
run: echo "key=$PROBE_CACHE_KEY" >> "$GITHUB_OUTPUT"

- name: Restore probe cache
id: restore-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .autoskillit/temp/probe-cache/codex
key: probe-codex-${{ steps.resolve-version.outputs.cli_version }}-${{ steps.resolve-policy.outputs.policy_identity }}
key: ${{ steps.resolve-cache-key.outputs.key }}

- name: Run Codex conformance probes
if: steps.restore-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -172,7 +178,7 @@ jobs:
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .autoskillit/temp/probe-cache/codex
key: probe-codex-${{ steps.resolve-version.outputs.cli_version }}-${{ steps.resolve-policy.outputs.policy_identity }}
key: ${{ steps.resolve-cache-key.outputs.key }}

- name: Post probe failure
if: failure()
Expand Down Expand Up @@ -269,12 +275,18 @@ jobs:
POLICY_IDENTITY=$(.venv/bin/python -c 'from autoskillit.execution.backends._probe_cache import PROBE_POLICY_IDENTITY; print(PROBE_POLICY_IDENTITY)')
echo "policy_identity=${POLICY_IDENTITY}" >> "$GITHUB_OUTPUT"

- name: Resolve probe cache key
id: resolve-cache-key
env:
PROBE_CACHE_KEY: probe-claude-${{ steps.resolve-version.outputs.cli_version }}-${{ steps.resolve-policy.outputs.policy_identity }}-${{ runner.os }}-${{ hashFiles('src/autoskillit/**', 'tests/**', '.autoskillit/recipes/**', 'pyproject.toml', 'uv.lock', '.github/workflows/conformance-probes.yml', '!**/__pycache__/**') }}
run: echo "key=$PROBE_CACHE_KEY" >> "$GITHUB_OUTPUT"

- name: Restore probe cache
id: restore-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .autoskillit/temp/probe-cache/claude
key: probe-claude-${{ steps.resolve-version.outputs.cli_version }}-${{ steps.resolve-policy.outputs.policy_identity }}
key: ${{ steps.resolve-cache-key.outputs.key }}

- name: Run Claude Code conformance probes
if: steps.restore-cache.outputs.cache-hit != 'true'
Expand All @@ -300,7 +312,7 @@ jobs:
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .autoskillit/temp/probe-cache/claude
key: probe-claude-${{ steps.resolve-version.outputs.cli_version }}-${{ steps.resolve-policy.outputs.policy_identity }}
key: ${{ steps.resolve-cache-key.outputs.key }}

- name: Upload bounded startup-readiness traces
if: always()
Expand Down
7 changes: 7 additions & 0 deletions src/autoskillit/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
AuditAdmissionStoreAuthority,
RecipeSource,
atomic_write,
claude_code_project_dir,
get_logger,
)

Expand Down Expand Up @@ -344,6 +345,12 @@ def update() -> None:
run_update_command()


@app.command
def claude_project_log_dir(cwd: str) -> None:
"""Write the Claude project log directory for an explicit working directory."""
sys.stdout.write(str(claude_code_project_dir(str(Path(cwd).resolve()))) + "\n")


@app.command
def doctor(*, output_json: bool = False, repair: bool = False) -> None:
"""Check project setup (``--repair`` opts into safe repairs)."""
Expand Down
1 change: 1 addition & 0 deletions src/autoskillit/core/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ from .io import fast_dumps as fast_dumps
from .io import fast_loads as fast_loads
from .io import find_latest_session_id as find_latest_session_id
from .io import github_review_ledger_path as github_review_ledger_path
from .io import is_claude_session_log as is_claude_session_log
from .io import is_generated_path as is_generated_path
from .io import is_git_main_checkout as is_git_main_checkout
from .io import is_git_worktree as is_git_worktree
Expand Down
2 changes: 2 additions & 0 deletions src/autoskillit/core/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
destination_location,
find_latest_session_id,
github_review_ledger_path,
is_claude_session_log,
is_generated_path,
is_git_main_checkout,
is_git_worktree,
Expand Down Expand Up @@ -142,6 +143,7 @@
"fast_loads",
"find_latest_session_id",
"github_review_ledger_path",
"is_claude_session_log",
"is_generated_path",
"is_git_main_checkout",
"is_git_worktree",
Expand Down
16 changes: 12 additions & 4 deletions src/autoskillit/core/io/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,13 @@ def resolve_project_dir() -> Path:
def claude_code_project_dir(cwd: str) -> Path:
"""Derive the Claude Code project log directory from a working directory path.

Encodes the cwd by replacing '/' and '_' with '-', matching Claude Code's
internal convention for ~/.claude/projects/<encoded-path>/.
Replace every UTF-16 unit outside ASCII letters and digits with a hyphen
under ~/.claude/projects/, matching the native JavaScript slug rule.
"""
project_hash = cwd.replace("/", "-").replace("_", "-")
project_hash = "".join(
char if char.isascii() and char.isalnum() else "-" * (2 if ord(char) > 0xFFFF else 1)
for char in cwd
)
return Path.home() / ".claude" / "projects" / project_hash


Expand All @@ -145,6 +148,11 @@ def claude_code_log_path(cwd: str, session_id: str) -> Path | None:
return claude_code_project_dir(cwd) / f"{session_id}.jsonl"


def is_claude_session_log(path: Path) -> bool:
"""Return whether a path names a session transcript rather than an orphaned copy."""
return path.suffix == ".jsonl" and ".orphaned-" not in path.name


def find_latest_session_id(cwd: str | None = None) -> str | None:
"""Return the session_id of the most recent Claude Code session for cwd.

Expand All @@ -163,7 +171,7 @@ def find_latest_session_id(cwd: str | None = None) -> str | None:
return None

jsonl_files = sorted(
(f for f in project_dir.glob("*.jsonl")),
(f for f in project_dir.glob("*.jsonl") if is_claude_session_log(f)),
key=lambda f: safe_mtime(f) or 0.0,
reverse=True,
)
Expand Down
2 changes: 2 additions & 0 deletions src/autoskillit/execution/process/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
kill_process_tree,
)
from autoskillit.execution.process._process_monitor import (
SessionMonitorResult,
_active_liveness_signals,
_has_active_child_processes,
_heartbeat,
Expand Down Expand Up @@ -162,6 +163,7 @@
"OwnerScope",
"OwnerScopeSealedError",
"OwnerScopeSettlement",
"SessionMonitorResult",
"TetherRecord",
"TetherSpec",
"TetherSweepOutcome",
Expand Down
3 changes: 2 additions & 1 deletion src/autoskillit/execution/process/_process_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
VANISHED_ERRORS,
ChannelBStatus,
get_logger,
is_claude_session_log,
read_active_operation_leases,
scan_observed,
)
Expand Down Expand Up @@ -271,7 +272,7 @@ async def _discover_session_log(
candidates = [
entry
for entry in scan_observed(session_log_dir)
if entry.path.suffix == ".jsonl" and entry.status.st_ctime > spawn_time
if is_claude_session_log(entry.path) and entry.status.st_ctime > spawn_time
]
session_file, session_entry = _select_session_log_file(
session_log_dir, candidates, expected_session_id, resume_cursor
Expand Down
12 changes: 4 additions & 8 deletions src/autoskillit/skills_extended/audit-bugs/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,18 @@ The user may provide a "since" date (e.g., `2/7`, `2026-02-07`, `last week`). If

### Step 1: Locate Project Logs

Claude Code stores conversation logs at `~/.claude/projects/` in a folder derived from the project's absolute path with `/` replaced by `-`.
Claude Code stores conversation logs under `~/.claude/projects/`. Resolve the directory for the current working directory through the installed CLI:

Derive the log directory:
```bash
# Convert current working directory to Claude's folder naming scheme
PROJECT_PATH=$(pwd)
LOG_DIR="$HOME/.claude/projects/-${PROJECT_PATH//\//-}"
# Remove leading double dash if present
LOG_DIR="${LOG_DIR//--/-}"
actual_absolute_cwd=$(pwd -P)
LOG_DIR=$(autoskillit claude-project-log-dir "$actual_absolute_cwd")
```

Verify the directory exists and contains `.jsonl` files.

### Step 2: Filter by Date and Investigate Skill

1. Use `find` with `-newermt` to filter `.jsonl` files modified since the target date
1. Use `find "$LOG_DIR"` with `-maxdepth 1`, `-name '*.jsonl'`, `! -name '*.orphaned-*.jsonl'`, and `-newermt` to filter session files modified since the target date, excluding orphaned copies
2. From those, `grep -l '"skill".*"investigate"'` to find files where the investigate skill was invoked (tool invocation pattern)
3. Also `grep -l '/autoskillit:investigate'` to catch user-typed invocations
4. Combine and deduplicate. Only use top-level files (not subagent logs under `*/subagents/`)
Expand Down
7 changes: 3 additions & 4 deletions src/autoskillit/skills_extended/audit-friction/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ For each match batch, use the bounded `-A 10 -B 10` command above to confirm it

### Step 1: Locate Project Logs

Derive the log directory from the current working directory:
Resolve the JSONL directory for the current working directory under `~/.claude/projects/` through the installed CLI:

```bash
PROJECT_PATH=$(pwd)
LOG_DIR="$HOME/.claude/projects/-${PROJECT_PATH//\//-}"
LOG_DIR="${LOG_DIR//--/-}"
actual_absolute_cwd=$(pwd -P)
LOG_DIR=$(autoskillit claude-project-log-dir "$actual_absolute_cwd")
```

Verify the directory exists and contains `.jsonl` files. If the directory is missing or empty, report this to the user before stopping.
Expand Down
7 changes: 3 additions & 4 deletions src/autoskillit/skills_extended/investigate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,11 @@ Before writing the report, check whether the root cause identified in Step 3 has
<!-- autoskillit:exploration-vector id="standard-recurrence-history" -->
#### Part A: Mine Past Investigation Logs

Derive the Claude project log directory from the current working directory:
Resolve the current project's JSONL directory under `~/.claude/projects/` through the installed CLI:

```bash
PROJECT_PATH=$(pwd)
LOG_DIR="$HOME/.claude/projects/-${PROJECT_PATH//\//-}"
LOG_DIR="${LOG_DIR//--/-}"
actual_absolute_cwd=$(pwd -P)
LOG_DIR=$(autoskillit claude-project-log-dir "$actual_absolute_cwd")
```

Search for `.jsonl` files containing prior AutoSkillit investigate-skill invocations, **excluding subagent log subdirectories** (`*/subagents/*`) so prior subagent conversations are not double-counted:
Expand Down
11 changes: 8 additions & 3 deletions src/autoskillit/skills_extended/setup-project/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,15 @@ Launch parallel child delegations against `project_dir`. If the user opted into

**Subagent F+ — Conversation History Mining (only if user opted in):**

Claude Code stores conversation history at `~/.claude/projects/<encoded-path>/` as JSONL files (one per session). The path encoding replaces `/` and `_` with `-` (e.g., `/home/user/my_project` -> `-home-user-my-project`).
Claude Code stores conversation history under `~/.claude/projects/` as JSONL files (one per session). Run this subagent with its tool cwd set to `project_dir`, then resolve that physical directory through the installed CLI:

1. Compute the encoded directory name from `project_dir`
2. List all `.jsonl` files in `~/.claude/projects/<encoded-name>/`, including subagent files in `<session-uuid>/subagents/agent-*.jsonl`
```bash
actual_absolute_cwd=$(pwd -P)
LOG_DIR=$(autoskillit claude-project-log-dir "$actual_absolute_cwd")
```

1. Verify `LOG_DIR` exists and contains `.jsonl` files; report missing or empty history before stopping
2. List session files with `find "$LOG_DIR" -name '*.jsonl' ! -name '*.orphaned-*.jsonl'`, including subagent files in `{session-uuid}/subagents/agent-*.jsonl` and excluding orphaned copies
3. Sort by modification time (newest first)
4. Divide into batches of ~20-30 files per subagent — launch multiple parallel subagents if needed

Expand Down
5 changes: 4 additions & 1 deletion src/autoskillit/workspace/skill_capabilities/_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
from autoskillit.core import SKILL_CAPABILITY_REGISTRY

_STATIC_PATTERNS: dict[str, tuple[re.Pattern[str], ...]] = {
"claude_dir": (re.compile(r"\.claude/"),),
"claude_dir": (
re.compile(r"\.claude/"),
re.compile(r"\bautoskillit\s+claude-project-log-dir\b"),
),
"commit_files": (re.compile(r"\bcommit_files\s*\("),),
"write_audit_semantic_result": (re.compile(r"\bwrite_audit_semantic_result\s*\("),),
"write_standalone_audit_evidence": (re.compile(r"\bwrite_standalone_audit_evidence\s*\("),),
Expand Down
41 changes: 41 additions & 0 deletions tests/cli/test_claude_project_log_dir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Tests for the side-effect-free Claude project-log directory command."""

from __future__ import annotations

from pathlib import Path

import pytest

pytestmark = [pytest.mark.layer("cli"), pytest.mark.small]


@pytest.mark.parametrize(
("cwd", "encoded"),
[
(
"/workspace/repro/.autoskillit/temp/sandbox",
"-workspace-repro--autoskillit-temp-sandbox",
),
("/home/user/projects/my_project", "-home-user-projects-my-project"),
("/home/user/projects/my_project/", "-home-user-projects-my-project"),
("/home/user/projects/my_project/.", "-home-user-projects-my-project"),
("workspace/repro/.", "-workspace-repro"),
],
)
def test_claude_project_log_dir_prints_one_exact_path_without_mcp_activation(
cwd: str,
encoded: str,
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
) -> None:
home = tmp_path / "home"
monkeypatch.setattr(Path, "home", lambda: home)
monkeypatch.chdir("/")
from autoskillit.cli.app import app

with pytest.raises(SystemExit) as exc_info:
app(["claude-project-log-dir", cwd])
assert exc_info.value.code == 0

assert capsys.readouterr().out == f"{home / '.claude' / 'projects' / encoded}\n"
16 changes: 16 additions & 0 deletions tests/contracts/test_skill_semantic_authenticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
pytestmark = [pytest.mark.layer("contracts"), pytest.mark.small]


@pytest.mark.parametrize(
("heading", "expected"),
[("## Step 1", frozenset({"claude_dir"})), ("## Examples", frozenset())],
)
def test_project_log_cli_requires_claude_dir_only_in_executable_instructions(
heading: str, expected: frozenset[str]
) -> None:
from autoskillit.workspace.skill_capabilities import detect_skill_capabilities

body = (
f"{heading}\n```bash\n"
'LOG_DIR=$(autoskillit claude-project-log-dir "$actual_absolute_cwd")\n```\n'
)
assert detect_skill_capabilities(body, "log-mining") == expected


def _parsed_body(path: Path) -> str:
from autoskillit.workspace import read_skill_frontmatter

Expand Down
Loading
Loading