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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To update later: `claude plugin marketplace update clone-labs && claude plugin u

- `--max-iterations <n>` — stop after N iterations (`0` = unlimited).
Start small (5–10) while you tune the prompt.
- `--clone-threshold <n>` — confidence threshold in `[0, 1]`. Default `0.8`.
- `--clone-threshold <n>` — confidence threshold in `[0, 1]`. Default `0.6`.
Below threshold, Clone hands control back to you.
- `--clone-agent "<label>"` — advanced; agent label sent to Clone.

Expand Down
2 changes: 1 addition & 1 deletion commands/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Start a Clone Loop in your current session.

```bash
/clone:loop "Refactor the cache layer" --max-iterations 20
/clone:loop "Add tests" --clone-threshold 0.8
/clone:loop "Add tests" --clone-threshold 0.7
```

**Options:**
Expand Down
4 changes: 2 additions & 2 deletions hooks/ask-user-question-hook.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function clonePredictNextPrompt({ agent, agentInput, threshold, sessionId
agent,
agent_input: agentInput,
k: 1,
threshold: Number(threshold || '0.8'),
threshold: Number(threshold || '0.6'),
}
if (sessionId) args.session_id = sessionId

Expand Down Expand Up @@ -450,7 +450,7 @@ async function main() {
const questions = Array.isArray(toolInput.questions) ? toolInput.questions : []
if (!questions.length) return

const cloneThreshold = cloneThresholdRaw || '0.8'
const cloneThreshold = cloneThresholdRaw || '0.6'
const cloneAgent = cloneAgentRaw || 'Claude Code Clone Loop'
const answers = {}
const confidenceValues = []
Expand Down
4 changes: 2 additions & 2 deletions hooks/stop-hook.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async function clonePredictNextPrompt({ agent, agentInput, threshold, sessionId
agent,
agent_input: agentInput,
k: 1,
threshold: Number(threshold || '0.8'),
threshold: Number(threshold || '0.6'),
}
if (sessionId) args.session_id = sessionId

Expand Down Expand Up @@ -246,7 +246,7 @@ async function main() {
clone_agent: cloneAgentRaw,
} = state.frontmatter

const cloneThreshold = cloneThresholdRaw || '0.8'
const cloneThreshold = cloneThresholdRaw || '0.6'
const cloneAgent = cloneAgentRaw || 'Claude Code Clone Loop'
const hookSession = hookInput.session_id ? String(hookInput.session_id) : ''

Expand Down
6 changes: 3 additions & 3 deletions scripts/manual-e2e-compare.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function callPredict(token, agentInput, label) {
agent: 'Claude Code Clone Loop',
agent_input: agentInput,
k: 3,
threshold: 0.8,
threshold: 0.6,
},
}, init.sessionId)
const content = call.payload?.result?.content?.[0]
Expand Down Expand Up @@ -167,7 +167,7 @@ console.error(`[compare] endpoint=${endpoint}`)
const baselineInput = formatConversationHistory({
promptText,
iteration: 4,
threshold: '0.8',
threshold: '0.6',
injectedUserTurns,
assistantTexts,
windowTurns: HISTORY_WINDOW_TURNS,
Expand All @@ -176,7 +176,7 @@ const baselineInput = formatConversationHistory({
const richInput = buildRichAgentInput({
promptText,
iteration: 4,
threshold: '0.8',
threshold: '0.6',
injectedUserTurns,
transcriptBlocks,
windowTurns: HISTORY_WINDOW_TURNS,
Expand Down
8 changes: 4 additions & 4 deletions scripts/manual-e2e-compare3.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function callPredict(token, agentInput, label) {
agent: 'Claude Code Clone Loop',
agent_input: agentInput,
k: 3,
threshold: 0.8,
threshold: 0.6,
},
}, init.sessionId)
const content = call.payload?.result?.content?.[0]
Expand Down Expand Up @@ -139,7 +139,7 @@ function buildA() {
return formatConversationHistory({
promptText,
iteration: 4,
threshold: '0.8',
threshold: '0.6',
injectedUserTurns,
assistantTexts,
windowTurns: HISTORY_WINDOW_TURNS,
Expand All @@ -150,7 +150,7 @@ function buildB() {
return formatConversationHistory({
promptText,
iteration: 4,
threshold: '0.8',
threshold: '0.6',
injectedUserTurns,
iterationBlocks: iterationTimelines[4],
windowTurns: HISTORY_WINDOW_TURNS,
Expand All @@ -167,7 +167,7 @@ function buildC() {
let baseline = formatConversationHistory({
promptText,
iteration: 4,
threshold: '0.8',
threshold: '0.6',
injectedUserTurns,
iterationBlocks: iterationTimelines[4].map((b) => ({ ...b })),
windowTurns: HISTORY_WINDOW_TURNS,
Expand Down
4 changes: 2 additions & 2 deletions scripts/manual-e2e-multiturn.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const iterationBlocks = [
const agentInput = formatConversationHistory({
promptText,
iteration: 4,
threshold: '0.8',
threshold: '0.6',
injectedUserTurns,
iterationBlocks,
windowTurns: HISTORY_WINDOW_TURNS,
Expand All @@ -94,7 +94,7 @@ const call = await rpc(token, 'tools/call', {
agent: 'Claude Code Clone Loop',
agent_input: agentInput,
k: 1,
threshold: 0.8,
threshold: 0.6,
},
}, init.sessionId)

Expand Down
4 changes: 2 additions & 2 deletions scripts/setup-clone-loop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { join } from 'node:path'
const args = process.argv.slice(2)
const promptParts = []
let maxIterations = '0'
let cloneThreshold = '0.8'
let cloneThreshold = '0.6'
let cloneAgent = 'Claude Code Clone Loop'
const ANSI_BOLD = '\u001b[1m'
const ANSI_PURPLE = '\u001b[35m'
Expand All @@ -23,7 +23,7 @@ ARGUMENTS:

OPTIONS:
--max-iterations <n> Maximum iterations before auto-stop (default: unlimited)
--clone-threshold <n> Clone auto/escalation threshold in [0, 1] (default: 0.8)
--clone-threshold <n> Clone auto/escalation threshold in [0, 1] (default: 0.6)
--clone-agent '<text>' Agent label sent to Clone (default: Claude Code Clone Loop)
-h, --help Show this help message

Expand Down
16 changes: 8 additions & 8 deletions tests/ask-user-question-hook.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function writeState(workdir, overrides = {}) {
iteration: 1,
max_iterations: 3,
session_id: 'session-123',
clone_threshold: 0.8,
clone_threshold: 0.6,
clone_agent: 'Claude Code Clone Loop',
prompt: 'Fix the bug and run tests.',
...overrides,
Expand Down Expand Up @@ -193,7 +193,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
{
id: 'question-prediction-1',
status: 'auto',
threshold: 0.8,
threshold: 0.6,
predicted_response: 'Run the focused tests first, then open a PR if green.',
confidence: 0.91,
},
Expand All @@ -208,7 +208,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
assert.equal(calls[1].params.name, 'predict_next_prompt')
assert.match(calls[1].params.arguments.agent_input, /What should we do next\?/)
assert.match(calls[1].params.arguments.agent_input, /Run tests/)
assert.equal(calls[1].params.arguments.threshold, 0.8)
assert.equal(calls[1].params.arguments.threshold, 0.6)
assert.equal(calls[1].params.arguments.k, 1)

const output = JSON.parse(result.stdout)
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
{
id: 'question-prediction-2',
status: 'escalated',
threshold: 0.8,
threshold: 0.6,
predicted_response: 'I would run the focused tests before opening a PR.',
confidence: 0.42,
},
Expand All @@ -280,7 +280,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
{
id: 'question-prediction-3',
status: 'auto',
threshold: 0.8,
threshold: 0.6,
confidence: 0.9,
candidates: [
{ predicted_response: 'Default fast path', confidence: 0.62 },
Expand Down Expand Up @@ -312,7 +312,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
{
id: 'question-prediction-4',
status: 'escalated',
threshold: 0.8,
threshold: 0.6,
confidence: 0.21,
candidates: [
{ predicted_response: 'Use the default option', confidence: 0.21 },
Expand Down Expand Up @@ -366,7 +366,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
decision: 'continue',
iteration: 1,
confidence: 0.9,
threshold: 0.8,
threshold: 0.6,
prediction_id: 'p-1',
status: 'auto',
predicted_response: 'Run lint after the tests pass.',
Expand All @@ -386,7 +386,7 @@ describe('AskUserQuestion PreToolUse hook', () => {
{
id: 'question-prediction-history',
status: 'auto',
threshold: 0.8,
threshold: 0.6,
predicted_response: 'Run focused tests',
confidence: 0.91,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/remote-mcp-e2e.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('Remote Clone MCP end-to-end flow', () => {
)
eventId(response, 'record_agent_response')

const threshold = 0.8
const threshold = 0.6
const prediction = parseToolBody(
await toolCall(
'predict_next_prompt',
Expand Down
2 changes: 1 addition & 1 deletion tests/setup-clone-loop.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Clone Loop setup script', () => {
const state = readFileSync(join(workdir, '.claude', 'clone-loop.local.md'), 'utf8')
assert.match(state, /launcher smoke test/)
assert.match(state, /max_iterations: 1/)
assert.match(state, /clone_threshold: 0\.8/)
assert.match(state, /clone_threshold: 0\.6/)
assert.doesNotMatch(state, /completion_promise/)
assert.doesNotMatch(state, /clone_k/)
} finally {
Expand Down
Loading
Loading