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
150 changes: 119 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# Context Tree Insights
# Context Tree Value Audit

`context-tree-insights` 0.2.3 is an explicit-only Codex Skill for task-first,
evidence-first analysis of Context Tree decision value. It reconstructs Tasks
from authorized Chats, separates confirmed from unresolved exposure, judges
four visible effect types, and stops sampling through a Task quota plus
`context-tree-value-audit` 0.2.4 is an explicit-only Skill for task-first,
evidence-first analysis of Context Tree decision value for the current First
Tree Runtime when its native historical evidence is supported. It reconstructs
Tasks from authorized Chats, separates confirmed from unresolved exposure,
judges four visible effect types, and stops sampling through a Task quota plus
saturation.

It is intentionally separate from First Tree core. It does not add a bundled
Skill, runtime event, database table, message-path validation, schedule,
Context Tree write, Web surface, or another provider adapter. It runs for one
First Tree Codex Agent, one managed workspace, and one bound Tree at a time.
Version 0.2.4 also renames the installable Skill from
`context-tree-insights` to `context-tree-value-audit`. Replace the old Skill
directory during upgrade; do not install both names because they represent one
explicit audit capability, not two independent workflows.

The audit core remains separate from First Tree core. Codex, Claude Code, and
Claude Code TUI use their existing native local transcripts. Cursor and Kimi
Code remain pending for historical value audits because their existing local
records cannot yet prove complete, Chat-bound Tree reads.
There is no shared Tree-read CLI, generic tool abstraction, runtime event,
database table, schedule, Context Tree write, or Web surface. Each run covers
one First Tree Agent, one managed workspace, one current Runtime, and one bound
Tree.

## Safety and interpretation

- Invocation is explicit only: `$context-tree-insights`.
- Invocation is explicit only: `$context-tree-value-audit` in Codex or
`/context-tree-value-audit` in Claude Code / Claude Code TUI.
- The invoking human authorizes all Chats for the current Agent, exact Chat
UUIDs for that Agent, or the invoking Chat resolved from runtime `chatId`.
- `Chat UUID @ Agent UUID` remains the authorization and trace-mapping unit;
Task is the judgment and counting unit.
- Local Codex traces are preflighted against authorized Chat IDs before full
content is scanned.
- Local Runtime evidence is preflighted against authorized Chat and Agent IDs
before complete recorded output is scanned.
- Missing, cleaned, ambiguous, malformed, truncated, or unsupported traces are
coverage gaps.
- A valid `contextDecision` is projected minimally. Absence is unknown;
Expand All @@ -40,48 +51,124 @@ JSONL, reports, or production-derived artifacts.
## Repository layout

```text
skills/context-tree-insights/
skills/context-tree-value-audit/
SKILL.md
VERSION
agents/openai.yaml
references/
evidence-schema.md
runtime-evidence-adapters.md
task-analysis-schema.md
scripts/context_tree_insights.py
scripts/context_tree_value_audit.py
projections/claude/context-tree-value-audit/
SKILL.md
tests/
evals/manual-behavior-checklist.md
```

Only `skills/context-tree-insights` is the installable Skill payload. Tests,
evaluation material, and repository documentation stay outside it.
`skills/context-tree-value-audit` is the canonical payload. The small Claude
projection supplies Claude's manual-invocation metadata and delegates to the
canonical payload. Tests, evaluation material, and repository documentation
stay outside both.

## Install into one Agent workspace

This repository does not install or enable the Skill automatically. Project
the Skill directory into one selected Agent workspace:
the Skill directory into one selected Agent workspace. For a fresh install:

```bash
CTI_REPO="/absolute/path/to/context-tree-insights"
CTI_AGENT_WORKSPACE="/absolute/path/to/selected/agent/workspace"
CTI_DESTINATION="$CTI_AGENT_WORKSPACE/.agents/skills/context-tree-insights"
CTVA_REPO="/absolute/path/to/context-tree-insights"
CTVA_AGENT_WORKSPACE="/absolute/path/to/selected/agent/workspace"
CTVA_SKILLS_ROOT="$CTVA_AGENT_WORKSPACE/.agents/skills"
CTVA_DESTINATION="$CTVA_SKILLS_ROOT/context-tree-value-audit"
CTVA_CLAUDE_ROOT="$CTVA_AGENT_WORKSPACE/.claude/skills"
CTVA_CLAUDE_DESTINATION="$CTVA_CLAUDE_ROOT/context-tree-value-audit"
CTVA_CLAUDE_SOURCE="$CTVA_REPO/projections/claude/context-tree-value-audit"

test ! -e "$CTVA_DESTINATION"
test ! -e "$CTVA_CLAUDE_DESTINATION"
test ! -L "$CTVA_CLAUDE_DESTINATION"
mkdir -p "$CTVA_SKILLS_ROOT" "$CTVA_CLAUDE_ROOT"
cp -R "$CTVA_REPO/skills/context-tree-value-audit" "$CTVA_DESTINATION"
cp -R "$CTVA_CLAUDE_SOURCE" "$CTVA_CLAUDE_DESTINATION"
diff -qr "$CTVA_CLAUDE_SOURCE" "$CTVA_CLAUDE_DESTINATION"
test -f "$CTVA_CLAUDE_DESTINATION/SKILL.md"
python3 "$CTVA_REPO/scripts/validate_skill.py"
```

test ! -e "$CTI_DESTINATION"
mkdir -p "$CTI_AGENT_WORKSPACE/.agents/skills"
cp -R "$CTI_REPO/skills/context-tree-insights" "$CTI_DESTINATION"
For an upgrade from the old 0.2.x name, move the exact legacy payload to a
recoverable directory outside every Skill discovery root, then install and
compare the new payload:

```bash
CTVA_REPO="/absolute/path/to/context-tree-insights"
CTVA_AGENT_WORKSPACE="/absolute/path/to/selected/agent/workspace"
CTVA_SKILLS_ROOT="$CTVA_AGENT_WORKSPACE/.agents/skills"
CTVA_OLD="$CTVA_SKILLS_ROOT/context-tree-insights"
CTVA_NEW="$CTVA_SKILLS_ROOT/context-tree-value-audit"
CTVA_SOURCE="$CTVA_REPO/skills/context-tree-value-audit"
CTVA_QUARANTINE="$CTVA_AGENT_WORKSPACE/.skill-quarantine/context-tree-insights"
CTVA_CLAUDE_ROOT="$CTVA_AGENT_WORKSPACE/.claude/skills"
CTVA_OLD_CLAUDE="$CTVA_CLAUDE_ROOT/context-tree-insights"
CTVA_NEW_CLAUDE="$CTVA_CLAUDE_ROOT/context-tree-value-audit"
CTVA_OLD_CLAUDE_TARGET="../../.agents/skills/context-tree-insights"
CTVA_CLAUDE_SOURCE="$CTVA_REPO/projections/claude/context-tree-value-audit"
CTVA_QUARANTINE_CLAUDE="$CTVA_AGENT_WORKSPACE/.skill-quarantine/context-tree-insights.claude-link"

test -f "$CTVA_OLD/SKILL.md"
test "$(sed -n 's/^name:[[:space:]]*//p' "$CTVA_OLD/SKILL.md")" = "context-tree-insights"
test ! -e "$CTVA_NEW"
test ! -e "$CTVA_NEW_CLAUDE"
test ! -L "$CTVA_NEW_CLAUDE"
test ! -e "$CTVA_QUARANTINE"
test ! -e "$CTVA_QUARANTINE_CLAUDE"
test ! -L "$CTVA_QUARANTINE_CLAUDE"
mkdir -p "$(dirname "$CTVA_QUARANTINE")" "$CTVA_CLAUDE_ROOT"
if test -e "$CTVA_OLD_CLAUDE" || test -L "$CTVA_OLD_CLAUDE"; then
test -L "$CTVA_OLD_CLAUDE"
test "$(readlink "$CTVA_OLD_CLAUDE")" = "$CTVA_OLD_CLAUDE_TARGET"
mv "$CTVA_OLD_CLAUDE" "$CTVA_QUARANTINE_CLAUDE"
fi
mv "$CTVA_OLD" "$CTVA_QUARANTINE"
cp -R "$CTVA_SOURCE" "$CTVA_NEW"
cp -R "$CTVA_CLAUDE_SOURCE" "$CTVA_NEW_CLAUDE"
diff -qr "$CTVA_SOURCE" "$CTVA_NEW"
diff -qr "$CTVA_CLAUDE_SOURCE" "$CTVA_NEW_CLAUDE"
test -f "$CTVA_NEW_CLAUDE/SKILL.md"
python3 "$CTVA_REPO/scripts/validate_skill.py"
test ! -e "$CTVA_OLD"
```

To roll back, move the new payload aside and restore the quarantined directory:

```bash
test -d "$CTVA_QUARANTINE"
test -d "$CTVA_NEW"
test -d "$CTVA_NEW_CLAUDE"
diff -qr "$CTVA_CLAUDE_SOURCE" "$CTVA_NEW_CLAUDE"
mv "$CTVA_NEW_CLAUDE" "$CTVA_QUARANTINE.failed-new.claude"
mv "$CTVA_NEW" "$CTVA_QUARANTINE.failed-new"
mv "$CTVA_QUARANTINE" "$CTVA_OLD"
if test -L "$CTVA_QUARANTINE_CLAUDE"; then
mv "$CTVA_QUARANTINE_CLAUDE" "$CTVA_OLD_CLAUDE"
fi
```

Start a new Codex session after installation. The
`allow_implicit_invocation: false` policy keeps the Skill out of ordinary
Start a new Runtime session after a successful install, upgrade, or rollback,
then confirm the intended single Skill name is callable. The Codex
`allow_implicit_invocation: false` policy and Claude
`disable-model-invocation: true` frontmatter keep the Skill out of ordinary
tasks. Pin a reviewed commit or release when installing for another Agent.

## Pipeline

The Skill orchestrates four stages:

1. `export-chats` resolves explicit authorization and exports visible records.
2. `collect` maps authorized Chats to local Codex traces, classifies every
in-window Tree-read attempt into a conserving four-state grammar, and
reconstructs exact or read-only-composite evidence plus visible choices.
2. `collect` maps authorized Chats to supported native local evidence,
classifies every in-window Tree-read attempt into a conserving four-state
grammar, and reconstructs exact or read-only-composite evidence plus visible
choices. Unsupported Runtime history stays pending.
3. The Agent reconstructs Tasks, Task-window exposure, effects, and sampling
signals in `task-judgments.jsonl`, including the reproducible five-check
rubric behind each `verified` or `probable` effect.
Expand All @@ -97,10 +184,11 @@ types represented, followed by 20-Task expansions until two consecutive
batches add no effect type, key counterexample, or conclusion change.

Detailed commands and schemas are in
[`SKILL.md`](skills/context-tree-insights/SKILL.md),
[`evidence-schema.md`](skills/context-tree-insights/references/evidence-schema.md),
[`SKILL.md`](skills/context-tree-value-audit/SKILL.md),
[`evidence-schema.md`](skills/context-tree-value-audit/references/evidence-schema.md),
[runtime-evidence-adapters.md](skills/context-tree-value-audit/references/runtime-evidence-adapters.md),
and
[`task-analysis-schema.md`](skills/context-tree-insights/references/task-analysis-schema.md).
[`task-analysis-schema.md`](skills/context-tree-value-audit/references/task-analysis-schema.md).

## Validate

Expand Down
62 changes: 48 additions & 14 deletions evals/manual-behavior-checklist.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Manual Behavior Checklist

Use this checklist before admitting a `context-tree-insights` revision. Run it
in a designated First Tree Codex Agent workspace against disposable or
sanitized records. Never commit generated artifacts.
Use this checklist before admitting a `context-tree-value-audit` revision. Run it
in designated First Tree Agent workspaces against disposable or sanitized
records. Never commit generated artifacts.

For a 0.2.4 upgrade, confirm the installed payload exposes only
`$context-tree-value-audit`; the superseded `$context-tree-insights` directory
must not remain as a second callable Skill. Exercise the README's minimal
move/copy/compare flow and confirm the old payload is outside both Skill
discovery roots. Confirm the Claude manual-invocation projection delegates to
the new canonical payload.

## Run record

Expand All @@ -15,14 +22,16 @@ Record in a private note:
- optional acquisition bound;
- artifact directory;
- clear Task quota and expansion batches.
- current Runtime and evidence-adapter version.

Capture the Tree HEAD, `git status --short`, and initial artifact directory
listing. Do not copy real trace passages into the test note.

## 1. Explicit routing and scope

In a fresh Chat, explicitly invoke `$context-tree-insights` and authorize
either all Chats for the current Agent or exact Chat UUIDs.
In a fresh Chat, explicitly invoke `$context-tree-value-audit` in Codex or
`/context-tree-value-audit` in Claude and authorize either all Chats for the
current Agent or exact Chat UUIDs.

Pass when:

Expand All @@ -45,7 +54,32 @@ Pass when:
- ordinary tasks do not load the Skill or scan history;
- `policy.allow_implicit_invocation` remains `false`.

## 2. Collector safety remains intact
## 2. Runtime evidence adapters remain isolated

Run the supported matrix with sanitized records:

- Codex root session JSONL;
- Claude Code root transcript JSONL;
- Claude Code TUI through the same Claude transcript family.

Pass when:

- the selected adapter exactly matches `FIRST_TREE_PROVIDER`;
- missing or invalid `FIRST_TREE_PROVIDER` fails closed instead of defaulting
to an adapter;
- every adapter maps one authorized Chat, current Agent, workspace, and bound
Tree before accepting complete output;
- Claude sidechain/subagent rows, tool-result echoes, and later session/Chat
drift do not become root evidence;
- Cursor and Kimi Code produce explicit
`historical_evidence_not_supported` gaps, no read IDs, and pending Tasks;
- no First Tree Runtime handler, local state schema, server, database, or Web
surface is changed for the audit;
- equal-timestamp results appended before their calls remain unresolved;
- a missing, cleaned, malformed, or unmapped source remains unresolved;
- the audit core emits the same candidate and Task schema for every Runtime.

## 3. Collector safety remains intact

Use sanitized traces covering:

Expand Down Expand Up @@ -85,7 +119,7 @@ Pass when:
- gaps remain diagnostic rather than being turned into negative exposure;
- artifacts keep `0700`/`0600` permissions and opaque local identities.

## 3. Receipt present, absent, and malformed
## 4. Receipt present, absent, and malformed

Export three sanitized messages:

Expand All @@ -104,7 +138,7 @@ Pass when:
- malformed receipt is omitted with `context_decision_invalid`;
- no malformed receipt blocks the message, Chat export, or audit.

## 4. One Chat splits into multiple Tasks
## 5. One Chat splits into multiple Tasks

Use one Chat containing two distinct objectives and outcomes.

Expand All @@ -116,7 +150,7 @@ Pass when:
- excluded Tasks contain no exposure or effects;
- one read or choice copied into both Tasks is rejected.

## 5. Cross-Chat handoff merge
## 6. Cross-Chat handoff merge

Use two Chats for one PR/MR/Issue or a visible handoff.

Expand All @@ -127,7 +161,7 @@ Pass when:
- the same fragments without linkage are rejected;
- unrelated Chats cannot be merged by topical similarity alone.

## 6. Confirmed and unresolved exposure
## 7. Confirmed and unresolved exposure

Create one Task with attributable Task-window reads and one historical Task
whose trace coverage cannot resolve exposure.
Expand All @@ -141,7 +175,7 @@ Pass when:
- reads outside the Task window or source Chats are rejected;
- unresolved Tasks appear in coverage counts, never an unused denominator.

## 7. Four effects, anchors, and deduplication
## 8. Four effects, anchors, and deduplication

Prepare valid examples of `confirmed`, `constrained`, `redirected`, and
`conflicted`, with `verified` or `probable` original judgments.
Expand All @@ -160,7 +194,7 @@ Pass when:
- reporter-derived support is definite only for confirmed + verified and
limited otherwise.

## 8. Task quota and saturation
## 9. Task quota and saturation

Run a sanitized sequence with:

Expand All @@ -186,7 +220,7 @@ Pass when:
- a Chat with messages inside the bound but later activity after `window.end`
is fetched and filtered rather than omitted.

## 9. Report conservation and language
## 10. Report conservation and language

Pass when the report includes:

Expand Down Expand Up @@ -222,7 +256,7 @@ After collection, redo Task-level exposure and effect judgment. Never reuse
the old blanket `unresolved` / empty-effects rows as negative cases, and never
let the current rerun erase the separately reviewed 37 positive effect Tasks.

## 10. No product or source mutation
## 11. No product or source mutation

Compare pre-run and post-run state.

Expand Down
11 changes: 11 additions & 0 deletions projections/claude/context-tree-value-audit/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: context-tree-value-audit
description: Run the manual, read-only Context Tree decision value audit for this First Tree Agent only when a human explicitly invokes /context-tree-value-audit.
disable-model-invocation: true
---

# Context Tree Value Audit

Read and follow
`../../../.agents/skills/context-tree-value-audit/SKILL.md` completely. Treat
that canonical payload directory as `CTVA_SKILL_DIR`.
Loading
Loading