leerness 1.9.318 → 1.9.320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +5 -5
- package/bin/harness.js +15 -7
- package/package.json +1 -1
- package/scripts/e2e.js +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.320 — 2026-06-04 — UR-0053(1단계): decisions/lessons count drift 버그 수정
|
|
4
|
+
|
|
5
|
+
**🔢 MD 파싱이 코드펜스 템플릿 예시까지 세어 `decisions=2 실제1` 로 오집계하던 count drift 버그 수정 (UR-0053 의 구체적 결함).**
|
|
6
|
+
|
|
7
|
+
### 배경 (UR-0053)
|
|
8
|
+
UR-0053 전략(상태 canonical=JSON, MD=projection) 중 **구체적으로 재현된 버그**: `context.memory.decisions=2 실제1`. 원인 — decisions.md/lessons.md 의 **Template 예시가 코드펜스(```md … ```) 안에 `### YYYY-MM-DD — Decision 제목` 형태**로 들어있는데, 카운터 6곳이 raw regex `match(/^### \d{4}-\d{2}-\d{2}/gm)` 로 **펜스 안 템플릿까지 카운트**.
|
|
9
|
+
|
|
10
|
+
### 구현 (UR-0053 1단계 — 비파괴 count 정합)
|
|
11
|
+
1. **`_countDatedBlocks(text)` 단일 진실소스** — 코드펜스 제거 후 `### YYYY-MM-DD` 헤더만 카운트 (기존 `_extractDecisionBlocks` 의 펜스 제거 로직과 동일 원리).
|
|
12
|
+
2. **6개 카운트 사이트 교체** (context / auto-resume / handoff·audit builder): decisions 2곳 + lessons 4곳 → `_countDatedBlocks` 사용. raw regex 카운트 0.
|
|
13
|
+
3. selftest 67→68 · e2e 264→265.
|
|
14
|
+
4. 전체 JSON-canonical 아키텍처(쓰기 경로 전환)는 별도 후속 — 본 단계는 **읽기 카운트 정합**(비파괴, behavior change 0).
|
|
15
|
+
|
|
16
|
+
### 검증
|
|
17
|
+
- **selftest 68/68 PASS** · **E2E 265/265 PASS** (회귀 0).
|
|
18
|
+
- 실측: decision 1건 + lesson 1건 추가 → `context` `memory.decisions=1, lessons=1` (이전 decisions=2) · `_countDatedBlocks`: 펜스 템플릿 제외(1), 펜스만(0), 펜스 없는 2건(2).
|
|
19
|
+
|
|
20
|
+
## 1.9.319 — 2026-06-04 — UR-0044(가드): MCP ToolRegistry 일치성 회귀 가드
|
|
21
|
+
|
|
22
|
+
**🛡 MCP 도구 def ↔ dispatch case 불일치(Unknown-tool 갭)를 영구 차단하는 회귀 가드 — UR-0044 의 실질 위험 해소.**
|
|
23
|
+
|
|
24
|
+
### 배경 (UR-0044 재평가)
|
|
25
|
+
UR-0044 원안은 "83-case switch 의 cliArgs 매핑을 도구 def 로 이전". 조사 결과:
|
|
26
|
+
- 현재 일치성 **갭 0**(83 def 모두 case 보유, 고아 case 0) — 즉시 버그는 없음.
|
|
27
|
+
- 진짜 위험은 **미래 드리프트**: mcp-tools.js 에 def 추가하고 switch case 누락 시 런타임에 조용히 `Unknown tool` 반환(테스트 부재).
|
|
28
|
+
- 전면 이전(인라인 230줄, MCP critical 경로)은 low 우선순위 대비 이동 위험이 큼 → **위험을 먼저 가드**하고 이전은 후속(계획).
|
|
29
|
+
|
|
30
|
+
### 구현 (UR-0044 가드)
|
|
31
|
+
1. **selftest 일치성 가드**: 모든 도구 def 가 dispatch `case` 보유 + 고아 case 0 + 모든 def 의 `requiredTier` 가 유효 tier(8종). 미래 def/case 드리프트 즉시 검출.
|
|
32
|
+
2. **e2e 런타임 스모크**: `tools/list` 수 = def 수(83) + 대표 도구(about/commands/pulse) dispatch 가 `-32601`(Unknown) 아님.
|
|
33
|
+
3. selftest 66→67 · e2e 263→264.
|
|
34
|
+
|
|
35
|
+
### 검증
|
|
36
|
+
- **selftest 67/67 PASS** · **E2E 264/264 PASS** (회귀 0).
|
|
37
|
+
- 실측: 83 def ↔ 83 case 1:1 일치, 고아 0, tier 완비 · tools/list=83 · about/commands/pulse dispatch 정상.
|
|
38
|
+
- 범위: 일치성·tier 가드(위험 해소). 매핑의 tool-def 물리적 이전은 후속(가드가 안전망 제공).
|
|
39
|
+
|
|
3
40
|
## 1.9.318 — 2026-06-04 — UR-0025: HTML 파싱 유틸 모듈 분리 + 락 테스트 격리
|
|
4
41
|
|
|
5
42
|
**🧩 점진적 비파괴 모듈화(UR-0025) 한 단계 + pre-wake-audit critical 조사 결과 정리.**
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **AI 코딩 에이전트의 거짓 완료·중복·망각·충돌을 막아주는 검수·기억·협업 CLI 하네스.**
|
|
4
4
|
> **A CLI harness that stops AI coding agents from faking completion, duplicating work, forgetting context, and colliding.**
|
|
5
5
|
|
|
6
|
-
[](https://www.npmjs.com/package/leerness) [](https://www.npmjs.com/package/leerness) []() []() []() []() []() []()
|
|
7
7
|
|
|
8
8
|
```
|
|
9
9
|
╔══════════════════════════════════════════════════════════════╗
|
|
@@ -471,7 +471,7 @@ MIT — © leerness contributors
|
|
|
471
471
|
<!-- leerness:project-readme:start -->
|
|
472
472
|
## Leerness Project Harness
|
|
473
473
|
|
|
474
|
-
이 프로젝트는 Leerness v1.9.
|
|
474
|
+
이 프로젝트는 Leerness v1.9.320 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
|
|
475
475
|
|
|
476
476
|
### 정체성 — AI 에이전트 운영 레이어 (UR-0030)
|
|
477
477
|
|
|
@@ -525,7 +525,7 @@ leerness memory restore decision <date|title>
|
|
|
525
525
|
|
|
526
526
|
### MCP server (외부 AI 통합)
|
|
527
527
|
|
|
528
|
-
Leerness v1.9.
|
|
528
|
+
Leerness v1.9.320는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
|
|
529
529
|
|
|
530
530
|
```jsonc
|
|
531
531
|
// 카테고리별
|
|
@@ -546,7 +546,7 @@ Leerness v1.9.318는 stdio JSON-RPC MCP server를 내장합니다 — Claude Cod
|
|
|
546
546
|
`<<autonomous-loop-dynamic>>` 신호만 보내면 AI가:
|
|
547
547
|
1) 다음 라운드 후보 선정 → 2) 코드 변경 → 3) stress-v* 신규 작성 + 누적 회귀 → 4) e2e 219/219 → 5) npm pack + git tag + GitHub release → 6) main 자동 push (1.9.140+) → 7) session close → 8) 다음 라운드 예약.
|
|
548
548
|
|
|
549
|
-
현재 누적: **70 라운드 (1.9.40 → 1.9.
|
|
549
|
+
현재 누적: **70 라운드 (1.9.40 → 1.9.320)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
|
|
550
550
|
|
|
551
551
|
### 성능 가이드 (1.9.140 측정)
|
|
552
552
|
|
|
@@ -584,6 +584,6 @@ leerness release pack --close --auto-main-push
|
|
|
584
584
|
- `.harness/session-handoff.md`: 다음 세션 인수인계 (자동 작성)
|
|
585
585
|
- `.harness/lessons.md` / `decisions.md` / `rules.md`: 영구 메모리 (5 surface)
|
|
586
586
|
|
|
587
|
-
Last synced by Leerness v1.9.
|
|
587
|
+
Last synced by Leerness v1.9.320: 2026-06-04
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -15,7 +15,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
|
|
|
15
15
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
16
16
|
const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
|
|
17
17
|
|
|
18
|
-
const VERSION = '1.9.
|
|
18
|
+
const VERSION = '1.9.320';
|
|
19
19
|
|
|
20
20
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
21
21
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -3118,6 +3118,8 @@ function _selfTestCases() {
|
|
|
3118
3118
|
{ name: 'drift 마커 버그: session-handoff 프론트매터는 ^--- 일 때만 + drift 최신 Last generated (1.9.316)', run: () => { const src = read(__filename); const writeFix = src.includes('if (/^---\\r?\\n/.test(cur))') && src.includes('writeUtf8(handoffPath(root), frontmatter + block)'); const readFix = src.includes('matchAll(/Last generated') && src.includes('allGen[allGen.length - 1]'); return writeFix && readFix; } },
|
|
3119
3119
|
{ name: '텔레메트리 분리: 내부 auto-call(LEERNESS_INTERNAL) usage 집계 제외 + 주요 spawn 마킹 (UR-0051 설치리뷰 1.9.317)', run: () => { const src = read(__filename); const guard = src.includes("process.env.LEERNESS_INTERNAL !== '1'"); const marked = (src.match(/LEERNESS_INTERNAL: '1'/g) || []).length >= 10; const reviewMarked = /'review-request'[\s\S]{0,200}LEERNESS_INTERNAL: '1'/.test(src); return guard && marked && reviewMarked; } },
|
|
3120
3120
|
{ name: 'lib/pure-utils: HTML 파싱 유틸 3종 모듈 분리 + 동작 + 인라인 제거 (UR-0025 1.9.318)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._htmlToText === 'function' && typeof m._extractTitle === 'function' && typeof m._extractLinks === 'function'; const work = m._htmlToText('<p>Hello <b>World</b></p>') === 'Hello World' && m._extractTitle('<html><title>My & Page</title></html>') === 'My & Page' && m._extractLinks('<a href="/a">A</a><a href="https://other.com/b">B</a>', 'https://x.com/').length === 1; const moved = m._htmlToText === _htmlToText && !/^function _htmlToText\(html\) \{/m.test(read(__filename)); return fnOk && work && moved; } },
|
|
3121
|
+
{ name: 'MCP ToolRegistry 일치성: 모든 도구 def 가 dispatch case 보유 + 고아 case 0 + requiredTier 완비 (UR-0044 1.9.319)', run: () => { const tools = require('../lib/mcp-tools'); const src = read(__filename); const missing = tools.filter(t => !src.includes("case '" + t.name + "':")); const cases = [...src.matchAll(/case '(leerness_[a-z_]+)':/g)].map(m => m[1]); const defNames = new Set(tools.map(t => t.name)); const orphans = [...new Set(cases)].filter(c => !defNames.has(c)); const tierOk = tools.every(t => typeof t.requiredTier === 'string' && PERMISSION_TIERS.includes(t.requiredTier)); return tools.length >= 83 && missing.length === 0 && orphans.length === 0 && tierOk; } },
|
|
3122
|
+
{ name: 'count drift 수정: _countDatedBlocks 코드펜스(템플릿) 제외 + 카운트 사이트 단일화 (UR-0053 1.9.320)', run: () => { const f = _countDatedBlocks; const withTpl = '# D\n\n```md\n### 2026-01-01 — Decision 제목\n- Decision:\n```\n\n### 2026-06-04 — 실제\n- Decision: 실제\n'; const c1 = f(withTpl) === 1; const c0 = f('```md\n### 2026-01-01 — x\n```\n') === 0; const c2 = f('### 2026-01-01 — A\n### 2026-02-02 — B\n') === 2; const src = read(__filename); const wired = src.includes('_countDatedBlocks(read(decisionsPath(root)))') && src.includes('_countDatedBlocks(read(lessonsPath(root)))') && src.includes('_countDatedBlocks(dtext)') && !src.includes('read(decisionsPath(root)).' + 'match(/^### '); return typeof f === 'function' && c1 && c0 && c2 && wired; } },
|
|
3121
3123
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3122
3124
|
];
|
|
3123
3125
|
}
|
|
@@ -4653,9 +4655,9 @@ function _buildAutoResumePlan(root, opts) {
|
|
|
4653
4655
|
// memory surface counts
|
|
4654
4656
|
const memorySurface = {
|
|
4655
4657
|
tasksInProgress: rows.filter(r => r.status === 'in-progress').length,
|
|
4656
|
-
decisions: exists(decisionsPath(root)) ? (read(decisionsPath(root))
|
|
4658
|
+
decisions: exists(decisionsPath(root)) ? _countDatedBlocks(read(decisionsPath(root))) : 0,
|
|
4657
4659
|
rulesActive: readRules(root).filter(r => r.status === 'active').length,
|
|
4658
|
-
lessons: exists(lessonsPath(root)) ? (read(lessonsPath(root))
|
|
4660
|
+
lessons: exists(lessonsPath(root)) ? _countDatedBlocks(read(lessonsPath(root))) : 0
|
|
4659
4661
|
};
|
|
4660
4662
|
return {
|
|
4661
4663
|
nextRoundVersion: opts.nextRoundVersion || `next after ${currentVersion}`,
|
|
@@ -7936,11 +7938,11 @@ function handoff(root) {
|
|
|
7936
7938
|
try {
|
|
7937
7939
|
const rows = readProgressRows(root);
|
|
7938
7940
|
const inProgressTasks = rows.filter(r => r.status === 'in-progress').length;
|
|
7939
|
-
const decisions = exists(decisionsPath(root)) ? (read(decisionsPath(root))
|
|
7941
|
+
const decisions = exists(decisionsPath(root)) ? _countDatedBlocks(read(decisionsPath(root))) : 0;
|
|
7940
7942
|
const rulesActive = readRules(root).filter(r => r.status === 'active').length;
|
|
7941
7943
|
const planText = exists(planPath(root)) ? read(planPath(root)) : '';
|
|
7942
7944
|
const planMilestones = (planText.match(/^### M-\d{4}\./gm) || []).length;
|
|
7943
|
-
const lessons = exists(lessonsPath(root)) ? (read(lessonsPath(root))
|
|
7945
|
+
const lessons = exists(lessonsPath(root)) ? _countDatedBlocks(read(lessonsPath(root))) : 0;
|
|
7944
7946
|
parts.push(`🧠 mem T${inProgressTasks}/D${decisions}/R${rulesActive}/P${planMilestones}/L${lessons}`);
|
|
7945
7947
|
} catch {}
|
|
7946
7948
|
// 8) 1.9.152: 활성 외부 AI CLI 카운트 (1.9.151 복수 선택 결과 반영) — 메인 에이전트가 sub-agent 분배 가능성 즉시 인지
|
|
@@ -12816,6 +12818,12 @@ function readSessionCounter(root) {
|
|
|
12816
12818
|
function writeSessionCounter(root, c) { writeUtf8(sessionCounterPath(root), JSON.stringify(c, null, 2) + '\n'); }
|
|
12817
12819
|
|
|
12818
12820
|
// 1.9.14 A/D: 결정 블록 추출 — 코드 블록 안의 ### + Template 제외
|
|
12821
|
+
// 1.9.320 (UR-0053, 설치리뷰): 날짜 블록(### YYYY-MM-DD) 카운트 단일 진실소스 — 코드펜스(```md 템플릿 예시) 제거 후 카운트.
|
|
12822
|
+
// 배경: decisions/lessons 카운터 6곳이 raw regex 로 코드펜스 안 Template 예시까지 세어 count drift(decisions=2 실제1) 발생.
|
|
12823
|
+
function _countDatedBlocks(text) {
|
|
12824
|
+
const cleaned = String(text || '').replace(/^```[^\n]*\n[\s\S]*?\n```\s*$/gm, ''); // 코드펜스(템플릿) 제거
|
|
12825
|
+
return (cleaned.match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length;
|
|
12826
|
+
}
|
|
12819
12827
|
function _extractDecisionBlocks(text) {
|
|
12820
12828
|
// 줄 시작의 ```부터 줄 시작의 ```까지를 코드블록으로 인식 (인라인 백틱 무시)
|
|
12821
12829
|
const cleaned = String(text || '').replace(/^```[^\n]*\n[\s\S]*?\n```\s*$/gm, '');
|
|
@@ -18441,7 +18449,7 @@ function contextCmd(root, opts = {}) {
|
|
|
18441
18449
|
let decisionCount = 0;
|
|
18442
18450
|
if (exists(decFile)) {
|
|
18443
18451
|
const dtext = read(decFile);
|
|
18444
|
-
decisionCount = (dtext
|
|
18452
|
+
decisionCount = _countDatedBlocks(dtext);
|
|
18445
18453
|
const blocks = _extractDecisionBlocks(dtext);
|
|
18446
18454
|
recentDecisions = blocks.slice(-3).reverse().map(block => {
|
|
18447
18455
|
const tm = (block.match(/^### (.+)$/m) || [])[1] || '';
|
|
@@ -18455,7 +18463,7 @@ function contextCmd(root, opts = {}) {
|
|
|
18455
18463
|
tasksInProgress: rows.filter(r => r.status === 'in-progress').length,
|
|
18456
18464
|
decisions: decisionCount,
|
|
18457
18465
|
rulesActive: activeRules.length,
|
|
18458
|
-
lessons: exists(lessonsPath(root)) ? (read(lessonsPath(root))
|
|
18466
|
+
lessons: exists(lessonsPath(root)) ? _countDatedBlocks(read(lessonsPath(root))) : 0
|
|
18459
18467
|
};
|
|
18460
18468
|
// 프로젝트 청사진 (1.9.308 UR-0055 2단계): brief 에서 의도/개요/방향이력 회수 (단일 출처)
|
|
18461
18469
|
const brief = _loadBrief(root);
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -3799,5 +3799,40 @@ total++;
|
|
|
3799
3799
|
if (!ok) failed++;
|
|
3800
3800
|
}
|
|
3801
3801
|
|
|
3802
|
+
// 1.9.319 회귀 (UR-0044): MCP ToolRegistry 일치성 — tools/list 수 = def 수 + 대표 도구 dispatch(Unknown tool 아님)
|
|
3803
|
+
total++;
|
|
3804
|
+
{
|
|
3805
|
+
let ok = false;
|
|
3806
|
+
try {
|
|
3807
|
+
const toolsLen = require(path.resolve(__dirname, '..', 'lib', 'mcp-tools.js')).length;
|
|
3808
|
+
const rList = cp.spawnSync(process.execPath, [CLI, 'mcp', 'serve'], { encoding: 'utf8', timeout: 10000, input: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }) + '\n' });
|
|
3809
|
+
let listOk = false; try { const t = JSON.parse(rList.stdout.split('\n').filter(Boolean)[0]).result.tools; listOk = t.length === toolsLen && toolsLen >= 83; } catch {}
|
|
3810
|
+
// 대표 read-only 도구 dispatch → -32601(Unknown tool) 아니어야 (switch 매핑 존재 확인)
|
|
3811
|
+
const callOne = (name) => { const r = cp.spawnSync(process.execPath, [CLI, 'mcp', 'serve'], { encoding: 'utf8', timeout: 15000, input: JSON.stringify({ jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name, arguments: {} } }) + '\n' }); try { const j = JSON.parse(r.stdout.split('\n').filter(Boolean)[0]); return !(j.error && j.error.code === -32601); } catch { return false; } };
|
|
3812
|
+
const dispatchOk = callOne('leerness_about') && callOne('leerness_commands') && callOne('leerness_pulse');
|
|
3813
|
+
ok = listOk && dispatchOk;
|
|
3814
|
+
} catch {}
|
|
3815
|
+
console.log(ok ? '✓ B(1.9.319) MCP ToolRegistry 일치성: tools/list=def 수 + 대표 도구 dispatch 정상 (UR-0044)' : '✗ ToolRegistry 일치성 실패');
|
|
3816
|
+
if (!ok) failed++;
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3819
|
+
// 1.9.320 회귀 (UR-0053): count drift — decisions/lessons 카운터가 코드펜스(```md 템플릿 예시) 제외 (decisions=2 실제1 버그)
|
|
3820
|
+
total++;
|
|
3821
|
+
{
|
|
3822
|
+
let ok = false;
|
|
3823
|
+
try {
|
|
3824
|
+
const cd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-countdrift-'));
|
|
3825
|
+
cp.spawnSync(process.execPath, [CLI, 'init', cd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
|
|
3826
|
+
cp.spawnSync(process.execPath, [CLI, 'decision', 'add', 'JWT 채택', '--path', cd, '--reason', 'stateless', '--alternatives', 'session', '--impact', '보안'], { encoding: 'utf8', timeout: 20000 });
|
|
3827
|
+
cp.spawnSync(process.execPath, [CLI, 'lesson', 'save', '락은 reentrant', '--path', cd], { encoding: 'utf8', timeout: 20000 });
|
|
3828
|
+
const r = cp.spawnSync(process.execPath, [CLI, 'context', '--path', cd, '--json'], { encoding: 'utf8', timeout: 20000 });
|
|
3829
|
+
let dec = null, les = null; try { const j = JSON.parse(r.stdout); dec = j.memory && j.memory.decisions; les = j.memory && j.memory.lessons; } catch {}
|
|
3830
|
+
ok = dec === 1 && les === 1; // 코드펜스 템플릿 제외 → 실제 1건씩 (이전: decisions=2)
|
|
3831
|
+
fs.rmSync(cd, { recursive: true, force: true });
|
|
3832
|
+
} catch {}
|
|
3833
|
+
console.log(ok ? '✓ B(1.9.320) count drift 수정: decisions/lessons 코드펜스 템플릿 제외 (실제 카운트) (UR-0053)' : '✗ count drift 실패');
|
|
3834
|
+
if (!ok) failed++;
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3802
3837
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
3803
3838
|
if (failed > 0) process.exit(1);
|