leerness 1.9.306 → 1.9.308

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 CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.308 — 2026-06-04 — UR-0055 (2단계 완료): 개발 방향 이력 + context/MCP 청사진 통합
4
+
5
+ **📘 프로젝트 청사진 기능 완성 — 개발 방향 변경/확대 이력 누적 + 에이전트가 청사진을 1콜로 회수(context/MCP). 사용자 요청 "개발 방향이 변경/확대될 때 업데이트" 완전 충족.**
6
+
7
+ ### 구현 (UR-0055 2단계)
8
+ 1. **`leerness brief update --direction "..."`** — 개발 방향 변경/확대를 날짜별 이력으로 누적(`## Direction History` append-only). README `**최근 개발 방향 변경**`(최근 3건) + blueprint export `개발 방향 이력` 섹션에 반영 → 프로젝트 진화 추적.
9
+ 2. **context 청사진 통합** — `contextCmd` 가 `_loadBrief` 단일출처로 intent + brief 요약(intro/features/최근방향) 노출. 에이전트가 작업 시작 시 프로젝트 정체성을 1콜로 파악.
10
+ 3. **MCP `leerness_brief` (83번째 도구, read-only)** — `{ path?, export? }` → 구조화 청사진(show) 또는 복사용 blueprint(export). 외부 에이전트가 "이 프로젝트가 무엇이고 어디로 가는가" 회수.
11
+ 4. selftest 55→56 · e2e 252→253.
12
+
13
+ ### 검증
14
+ - **selftest 56/56 PASS** · **E2E 253/253 PASS** (회귀 0).
15
+ - 실측: `brief update --direction` ×2 → Direction History 2건 누적 + README 최근방향 + export 이력 · `context --json` brief.latestDirection 노출 · MCP leerness_brief 가 directionHistory/features 반환.
16
+
17
+ ### 🎉 UR-0055 완료 (사용자 명시 — 프로젝트 청사진)
18
+ - 1단계(1.9.307): brief set/show/export + README 개요 섹션
19
+ - 2단계(1.9.308): update --direction 이력 + context/MCP 통합
20
+ - 결과: 프로젝트 개요/소개/목적/기능을 README 에 유지·업데이트 + 복사하면 신규 프로젝트를 기초부터 재시작할 수 있는 blueprint.
21
+
22
+ ## 1.9.307 — 2026-06-04 — UR-0055 (1단계): 프로젝트 청사진 brief (README 개요 + 복사용 blueprint)
23
+
24
+ **📘 사용자 명시 — 프로젝트 개요/소개/목적/기능을 README 에 작성·유지하고, 그 내용만 복사하면 신규 프로젝트를 기초부터 재시작할 수 있는 자기완결 청사진(blueprint) 생성. 기존 `.harness/project-brief.md` 비파괴 확장.**
25
+
26
+ ### 배경 (사용자 명시)
27
+ "개발 중인 프로그램/프로젝트의 소개·목적·설명을 README 에 쓰고, 개발 방향 변경/확대 시 업데이트, 복사하면 신규 프로젝트 계획으로 쓸 수 있게(기초부터 재시작)". 기존 project-brief.md(Project/Purpose/Users/Success)는 빈약 → 10필드로 확장 + README 동기화 + export.
28
+
29
+ ### 구현 (UR-0055 1단계)
30
+ 1. **`.harness/project-brief.md` 10필드 확장** — intro/purpose/problem/features/stack/architecture/users/success/nonGoals/currentState (`## Section` 블록, 파서/직렬화, frontmatter 보존, 비파괴).
31
+ 2. **`leerness brief set --intro/--purpose/--features/--stack/...`** — 정본 갱신 + README `## 프로젝트 개요` 관리 섹션(`<!-- leerness:project-brief:start/end -->`) 자동 동기화. **멱등 업데이트**(주어진 필드만 갱신, 나머지 보존 → 개발 방향 변경/확대 반영).
32
+ 3. **`leerness brief show [--json]`** — 채움 현황(N/10) + 필드 표시.
33
+ 4. **`leerness brief export [--out plan.md]`** — 자기완결 blueprint(소개+목적+문제+기능+아키텍처+스택+성공기준+비목표+현재상태 + "신규 프로젝트 시작 가이드") → 복사하면 기초부터 재시작 가능.
34
+ 5. selftest 54→55 · e2e 251→252.
35
+
36
+ ### 검증
37
+ - **selftest 55/55 PASS** · **E2E 252/252 PASS** (회귀 0).
38
+ - 실측: `brief set` → project-brief.md(## Intro/Features) + README 개요 섹션 동기화 · 멱등 업데이트(--purpose 만 갱신 시 intro/features 보존) · README 섹션 중복 0(재sync) · `brief export` blueprint(방향 변경 반영 + 신규프로젝트 가이드).
39
+
40
+ ### 남은 부분 (UR-0055 2단계)
41
+ - `brief update --direction "..."`(개발 방향 변경 이력 누적) + handoff/context 청사진 노출 확장 + MCP `leerness_brief` 도구.
42
+
3
43
  ## 1.9.306 — 2026-06-04 — UR-0045: exit code 일관성 (설치리뷰 3중수렴 high)
4
44
 
5
45
  **🚦 clean-install 리뷰에서 Codex·Sonnet·Opus 가 공통 high 로 지적한 "실패가 exit 0" 문제 수정 — CI·MCP·AI 에이전트가 실패를 성공으로 오판하던 근본 신뢰 결함. (직전 라운드의 인식론적 정직성과 직결: 에이전트가 거짓 성공을 믿지 않게.)**
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
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.306-green)]() [![tests](https://img.shields.io/badge/e2e-251%2F251-success)]() [![selftest](https://img.shields.io/badge/selftest-54-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-82-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
6
+ [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.308-green)]() [![tests](https://img.shields.io/badge/e2e-253%2F253-success)]() [![selftest](https://img.shields.io/badge/selftest-56-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-83-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
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.306 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.308 하네스를 사용합니다. 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.306는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **82개 도구**를 노출:
528
+ Leerness v1.9.308는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
529
529
 
530
530
  ```jsonc
531
531
  // 카테고리별
@@ -538,7 +538,7 @@ Leerness v1.9.306는 stdio JSON-RPC MCP server를 내장합니다 — Claude Cod
538
538
  // • Workflow: session_close / agents_list / task_export / env_check / usage_stats / reuse_map / whats_new
539
539
 
540
540
  // MCP server 실행: leerness mcp serve
541
- // tools/list 응답: 82 도구
541
+ // tools/list 응답: 83 도구
542
542
  ```
543
543
 
544
544
  ### Autonomous mode (자율 모드)
@@ -546,7 +546,7 @@ Leerness v1.9.306는 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.306)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.308)** · 매 라운드 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.306: 2026-06-04
587
+ Last synced by Leerness v1.9.308: 2026-06-04
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -14,7 +14,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
14
14
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
15
15
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
16
16
 
17
- const VERSION = '1.9.306';
17
+ const VERSION = '1.9.308';
18
18
 
19
19
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
20
20
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -61,6 +61,9 @@ if (require.main === module) _cliBootstrap();
61
61
  const MARK = '<!-- leerness:managed -->';
62
62
  const README_START = '<!-- leerness:project-readme:start -->';
63
63
  const README_END = '<!-- leerness:project-readme:end -->';
64
+ // 1.9.307 (UR-0055 사용자명시): 프로젝트 청사진(brief) — README 개요 섹션 마커.
65
+ const BRIEF_START = '<!-- leerness:project-brief:start -->';
66
+ const BRIEF_END = '<!-- leerness:project-brief:end -->';
64
67
 
65
68
  // 1.9.10: leerness-skillpack 동적 로드 (선택). 없으면 BUILTIN 사용.
66
69
  function _tryLoadSkillpack() {
@@ -3075,6 +3078,8 @@ function _selfTestCases() {
3075
3078
  { name: 'lib/analyzers: 분석/검증 함수 4종 모듈 단일출처 분리 (UR-0025 1.9.304)', run: () => { const m = require('../lib/analyzers'); return m._evidenceQuality === _evidenceQuality && m._shellGuardAnalyze === _shellGuardAnalyze && m._parseEvidenceStats === _parseEvidenceStats && m._claimFileInGit === _claimFileInGit && !/function _evidenceQuality\(evidence\) \{/.test(read(__filename)) && !/function _shellGuardAnalyze\(cmd, ctx\) \{/.test(read(__filename)); } },
3076
3079
  { name: 'honesty-check: AI 인식론적 정직성 3차원 + MCP/CLI/strict 통합 (사용자명시 1.9.305)', run: () => { const h = _epistemicHonestyCheck; const d1 = h('이 기능은 항상 정상 동작합니다').findings.some(f => f.dim === 'pretend-knowledge'); const d2 = h('아마 될 것 같습니다. 구현 완료했습니다').findings.some(f => f.dim === 'premature-judgment'); const d3 = h('이 API 의 rate limit 은 초당 5회입니다').findings.some(f => f.dim === 'no-info-gathering'); const clean = h('src/api.js 수정, 12/12 통과 (Exit: 0)').ok === true; const src = read(__filename); const wired = require('../lib/mcp-tools').some(t => t.name === 'leerness_honesty_check') && /if \(cmd === 'honesty-check'\)/.test(src) && /honestyFindings = _epistemicHonestyCheck/.test(src); return d1 && d2 && d3 && clean && wired; } },
3077
3080
  { name: 'exit code 일관성: fail()→exitCode 1 + unknown 명령 안내 (UR-0045 설치리뷰 1.9.306)', run: () => { const src = read(__filename); return /function fail\(s\) \{ log\('✗ ' \+ s\); process\.exitCode = 1; \}/.test(src) && /알 수 없는 명령: \$\{cmd\}/.test(src) && /if \(cmd === 'help' \|\| cmd === 'commands'/.test(src); } },
3081
+ { name: 'brief: 프로젝트 청사진 set/show/export + README 개요 섹션 (UR-0055 사용자명시 1.9.307)', run: () => { const src = read(__filename); const fnOk = typeof briefCmd === 'function' && typeof _loadBrief === 'function' && typeof _briefBlueprint === 'function' && _BRIEF_FIELDS.length === 10; const b = { project: 'X', intro: 'i', purpose: 'p', problem: '', features: ['f1', 'f2'], stack: ['s'], architecture: '', users: [], success: [], nonGoals: [], currentState: '' }; const bp = _briefBlueprint('.', b); const bpOk = /Blueprint/.test(bp) && /소개 \(Intro\)/.test(bp) && /f1/.test(bp) && /신규 프로젝트 시작 가이드/.test(bp); const rb = _briefReadmeBlock(b); const rbOk = rb.includes(BRIEF_START) && rb.includes(BRIEF_END) && /프로젝트 개요/.test(rb) && /\*\*목적\*\*/.test(rb); return fnOk && bpOk && rbOk && /if \(cmd === 'brief'\)/.test(src); } },
3082
+ { name: 'brief 2단계: update --direction 이력 + MCP leerness_brief + context 통합 (UR-0055 1.9.308)', run: () => { const src = read(__filename); const b = { project: 'X', intro: '', purpose: '', problem: '', features: [], stack: [], architecture: '', users: [], success: [], nonGoals: [], currentState: '', directionHistory: ['2026-06-04: 확대'] }; const bpOk = /개발 방향 이력/.test(_briefBlueprint('.', b)) && /최근 개발 방향 변경/.test(_briefReadmeBlock(b)); const histWired = /sub === 'update'/.test(src) && /brief\.directionHistory \|\| \[\]\), `\$\{today\(\)\}/.test(src); const mcpOk = require('../lib/mcp-tools').some(t => t.name === 'leerness_brief'); const ctxOk = /brief: \{ intro:/.test(src); return bpOk && histWired && mcpOk && ctxOk; } },
3078
3083
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3079
3084
  ];
3080
3085
  }
@@ -16927,6 +16932,9 @@ function mcpServeCmd(root) {
16927
16932
  case 'leerness_honesty_check':
16928
16933
  cliArgs = ['honesty-check', ...(args.text ? ['--text', String(args.text)] : [String(args.taskId || '')]), '--path', targetPath, '--json'];
16929
16934
  break;
16935
+ case 'leerness_brief':
16936
+ cliArgs = ['brief', args.export === true ? 'export' : 'show', '--path', targetPath, ...(args.export === true ? [] : ['--json'])];
16937
+ break;
16930
16938
  default:
16931
16939
  return send({ jsonrpc: '2.0', id, error: { code: -32601, message: `Unknown tool: ${name}` } });
16932
16940
  }
@@ -18219,6 +18227,135 @@ function aboutCmd(opts = {}) {
18219
18227
  log(`표면: MCP ${id.surface.mcpTools} 도구 · 어댑터 ${id.surface.adapters.length} · provider ${id.surface.providers} · 런타임 의존성 ${id.surface.runtimeDeps} · offline-first ${id.surface.offlineFirst ? '✓' : '✗'}`);
18220
18228
  return id;
18221
18229
  }
18230
+ // ===== 1.9.307 (UR-0055 사용자명시): 프로젝트 청사진(brief) =====
18231
+ // 프로젝트 개요/소개/목적/기능을 .harness/project-brief.md(정본)에 유지 + README 개요 섹션 동기화 + 복사용 blueprint export.
18232
+ // "복사하면 신규 프로젝트를 기초부터 재시작할 수 있는" 자기완결 청사진. 기존 project-brief.md 확장(비파괴).
18233
+ const _BRIEF_FIELDS = [
18234
+ { key: 'intro', h: 'Intro', label: '소개', flag: 'intro', multi: false },
18235
+ { key: 'purpose', h: 'Purpose', label: '목적', flag: 'purpose', multi: false },
18236
+ { key: 'problem', h: 'Problem', label: '해결 문제', flag: 'problem', multi: false },
18237
+ { key: 'features', h: 'Features', label: '핵심 기능', flag: 'features', multi: true },
18238
+ { key: 'stack', h: 'Tech Stack', label: '기술 스택', flag: 'stack', multi: true },
18239
+ { key: 'architecture', h: 'Architecture', label: '아키텍처', flag: 'architecture', multi: false },
18240
+ { key: 'users', h: 'Users', label: '사용자', flag: 'users', multi: true },
18241
+ { key: 'success', h: 'Success Criteria', label: '성공 기준', flag: 'success', multi: true },
18242
+ { key: 'nonGoals', h: 'Non-Goals', label: '비목표', flag: 'non-goals', multi: true },
18243
+ { key: 'currentState', h: 'Current State', label: '현재 상태', flag: 'current-state', multi: false },
18244
+ ];
18245
+ function _briefPath(root) { return path.join(absRoot(root), '.harness', 'project-brief.md'); }
18246
+ function _loadBrief(root) {
18247
+ const brief = { project: detectProjectName(absRoot(root)), directionHistory: [] };
18248
+ for (const f of _BRIEF_FIELDS) brief[f.key] = f.multi ? [] : '';
18249
+ const p = _briefPath(root);
18250
+ if (!exists(p)) return brief;
18251
+ for (const b of read(p).split(/\n(?=## )/)) {
18252
+ const m = b.match(/^## (.+?)\n([\s\S]*)$/);
18253
+ if (!m) continue;
18254
+ const head = m[1].trim(), body = m[2].trim();
18255
+ if (head === 'Project') { brief.project = (body.replace(/^[-*]\s*/, '').split('\n')[0] || '').trim() || brief.project; continue; }
18256
+ if (head === 'Direction History') { brief.directionHistory = body.split('\n').map(l => l.replace(/^[-*]\s*/, '').trim()).filter(l => l && l !== '-'); continue; }
18257
+ const f = _BRIEF_FIELDS.find(x => x.h === head);
18258
+ if (!f) continue;
18259
+ if (f.multi) brief[f.key] = body.split('\n').map(l => l.replace(/^[-*]\s*/, '').trim()).filter(l => l && l !== '-' && !/업데이트하세요/.test(l));
18260
+ else { const v = body.replace(/^[-*]\s*/, '').trim(); brief[f.key] = /업데이트하세요/.test(v) ? '' : v; }
18261
+ }
18262
+ return brief;
18263
+ }
18264
+ function _saveBrief(root, brief) {
18265
+ let body = `# Project Brief\n\n## Project\n${brief.project || detectProjectName(absRoot(root))}\n`;
18266
+ for (const f of _BRIEF_FIELDS) {
18267
+ const v = brief[f.key];
18268
+ body += `\n## ${f.h}\n`;
18269
+ if (f.multi) body += (v && v.length ? v.map(x => `- ${x}`).join('\n') : '-') + '\n';
18270
+ else body += (v ? v : '- 이 항목을 실제 내용으로 업데이트하세요.') + '\n';
18271
+ }
18272
+ // 1.9.308 (UR-0055 2단계): 개발 방향 변경/확대 이력 (append-only, 날짜별)
18273
+ if (brief.directionHistory && brief.directionHistory.length) body += `\n## Direction History\n` + brief.directionHistory.map(x => `- ${x}`).join('\n') + '\n';
18274
+ writeUtf8(_briefPath(root), fm('project-brief', ['프로젝트 목적 확인', '신규 기능 판단', '계획 수립'], ['프로젝트 목적 변경', '사용자/범위 변경'], body));
18275
+ }
18276
+ function _briefFilled(brief) { return _BRIEF_FIELDS.filter(f => (f.multi ? (brief[f.key] && brief[f.key].length) : brief[f.key])).length; }
18277
+ function _briefReadmeBlock(brief) {
18278
+ const L = [BRIEF_START, '## 프로젝트 개요', ''];
18279
+ if (brief.intro) L.push(brief.intro, '');
18280
+ if (brief.purpose) L.push(`**목적**: ${brief.purpose}`, '');
18281
+ if (brief.problem) L.push(`**해결 문제**: ${brief.problem}`, '');
18282
+ if (brief.features && brief.features.length) { L.push('**핵심 기능**'); brief.features.forEach(x => L.push(`- ${x}`)); L.push(''); }
18283
+ if (brief.stack && brief.stack.length) L.push(`**기술 스택**: ${brief.stack.join(', ')}`, '');
18284
+ if (brief.directionHistory && brief.directionHistory.length) { L.push('**최근 개발 방향 변경**'); brief.directionHistory.slice(-3).forEach(x => L.push(`- ${x}`)); L.push(''); }
18285
+ if (_briefFilled(brief) === 0) L.push('_아직 개요 미입력 — `leerness brief set --intro "..." --purpose "..."` 로 작성._', '');
18286
+ L.push('<sub>이 섹션은 `leerness brief` 로 관리됩니다. 전체 청사진(복사용): `leerness brief export`.</sub>', BRIEF_END);
18287
+ return L.join('\n');
18288
+ }
18289
+ function _syncBriefReadme(root, brief) {
18290
+ const p = path.join(absRoot(root), 'README.md');
18291
+ const existing = exists(p) ? read(p) : '';
18292
+ const block = _briefReadmeBlock(brief);
18293
+ const s = existing.indexOf(BRIEF_START), e = existing.indexOf(BRIEF_END);
18294
+ let updated;
18295
+ if (s >= 0 && e >= s) updated = existing.slice(0, s).trimEnd() + '\n\n' + block + '\n' + existing.slice(e + BRIEF_END.length).trimStart();
18296
+ else if (existing.trim()) updated = existing.trimEnd() + '\n\n' + block + '\n';
18297
+ else updated = `# ${brief.project}\n\n${block}\n`;
18298
+ writeUtf8(p, updated);
18299
+ }
18300
+ function _briefBlueprint(root, brief) {
18301
+ const L = [`# ${brief.project} — 프로젝트 청사진 (Blueprint)`,
18302
+ `> 이 문서만으로 프로젝트를 기초부터 재구성할 수 있도록 작성. \`leerness brief export\` 생성 (leerness v${VERSION}).`, ''];
18303
+ const sec = (h, v, multi) => { if (multi ? (v && v.length) : v) { L.push(`## ${h}`, multi ? v.map(x => `- ${x}`).join('\n') : v, ''); } };
18304
+ sec('소개 (Intro)', brief.intro); sec('목적 (Purpose)', brief.purpose); sec('해결 문제 (Problem)', brief.problem);
18305
+ sec('핵심 기능 (Features)', brief.features, true); sec('기술 스택 (Tech Stack)', brief.stack, true);
18306
+ sec('아키텍처 (Architecture)', brief.architecture); sec('사용자 (Users)', brief.users, true);
18307
+ sec('성공 기준 (Success Criteria)', brief.success, true); sec('비목표 (Non-Goals)', brief.nonGoals, true);
18308
+ sec('현재 상태 (Current State)', brief.currentState);
18309
+ sec('개발 방향 이력 (Direction History)', brief.directionHistory, true);
18310
+ L.push('---', '## 신규 프로젝트 시작 가이드', '', '1. 위 소개·목적·기능·아키텍처·스택을 신규 레포의 계획으로 복사.', '2. `leerness init .` 후 이 파일을 `.harness/project-brief.md` 로 복사하거나 `leerness brief set` 으로 재입력.', '3. Features 를 `leerness plan add` / `leerness task add` 로 분해.', '');
18311
+ return L.join('\n');
18312
+ }
18313
+ function briefCmd(root, sub) {
18314
+ root = absRoot(root || process.cwd());
18315
+ const isTty = process.stdout && process.stdout.isTTY;
18316
+ const cy = s => isTty ? `\x1b[36m${s}\x1b[0m` : s, gr = s => isTty ? `\x1b[32m${s}\x1b[0m` : s, dm = s => isTty ? `\x1b[2m${s}\x1b[0m` : s;
18317
+ sub = sub || 'show';
18318
+ if (sub === 'set') {
18319
+ const brief = _loadBrief(root);
18320
+ let changed = 0;
18321
+ const proj = arg('--project', null); if (proj != null) { brief.project = proj; changed++; }
18322
+ for (const f of _BRIEF_FIELDS) { const v = arg('--' + f.flag, null); if (v != null) { brief[f.key] = f.multi ? _splitList(v) : v; changed++; } }
18323
+ if (!changed) { fail('brief set: 최소 하나의 필드 필요 (--intro --purpose --problem --features --stack --architecture --users --success --non-goals --current-state --project)'); return; }
18324
+ _saveBrief(root, brief);
18325
+ _syncBriefReadme(root, brief);
18326
+ ok(`brief 갱신 (${changed}개 필드) → .harness/project-brief.md + README 개요 섹션 동기화`);
18327
+ return;
18328
+ }
18329
+ if (sub === 'show') {
18330
+ const brief = _loadBrief(root);
18331
+ if (has('--json')) { log(JSON.stringify(brief, null, 2)); return; }
18332
+ log(cy(`# leerness brief — ${brief.project}`));
18333
+ for (const f of _BRIEF_FIELDS) { const v = brief[f.key]; const filled = f.multi ? (v && v.length) : v; log(` ${filled ? gr('✓') : dm('·')} ${f.label}: ${filled ? (f.multi ? v.join(', ') : v).slice(0, 90) : dm('(미입력)')}`); }
18334
+ log('');
18335
+ log(dm(` 채움 ${_briefFilled(brief)}/${_BRIEF_FIELDS.length} · 설정: leerness brief set --intro "..." · 복사용: leerness brief export`));
18336
+ return;
18337
+ }
18338
+ if (sub === 'export') {
18339
+ const brief = _loadBrief(root);
18340
+ const bp = _briefBlueprint(root, brief);
18341
+ const out = arg('--out', null);
18342
+ if (out) { const op = path.isAbsolute(out) ? out : path.join(root, out); writeUtf8(op, bp); ok(`blueprint export → ${rel(root, op)} (${_briefFilled(brief)}/${_BRIEF_FIELDS.length} 필드)`); return; }
18343
+ log(bp);
18344
+ return;
18345
+ }
18346
+ if (sub === 'update') {
18347
+ // 1.9.308 (UR-0055 2단계): 개발 방향 변경/확대 이력 추가 (날짜별 append).
18348
+ const dir = arg('--direction', null);
18349
+ if (dir == null) { fail('brief update --direction "<개발 방향 변경/확대 내용>" 필요'); return; }
18350
+ const brief = _loadBrief(root);
18351
+ brief.directionHistory = [...(brief.directionHistory || []), `${today()}: ${dir}`];
18352
+ _saveBrief(root, brief);
18353
+ _syncBriefReadme(root, brief);
18354
+ ok(`방향 이력 추가 (총 ${brief.directionHistory.length}건) → project-brief.md Direction History`);
18355
+ return;
18356
+ }
18357
+ fail(`brief: 알 수 없는 sub: ${sub} (set | show | export | update)`);
18358
+ }
18222
18359
  function contextCmd(root, opts = {}) {
18223
18360
  root = absRoot(root);
18224
18361
  const rows = readProgressRows(root);
@@ -18247,17 +18384,14 @@ function contextCmd(root, opts = {}) {
18247
18384
  rulesActive: activeRules.length,
18248
18385
  lessons: exists(lessonsPath(root)) ? (read(lessonsPath(root)).match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length : 0
18249
18386
  };
18250
- // 프로젝트 의도 (best-effort) — .harness/project-brief.md ## Purpose
18251
- let intent = null;
18252
- const briefPath = path.join(root, '.harness', 'project-brief.md');
18253
- if (exists(briefPath)) {
18254
- const m = read(briefPath).match(/##\s*Purpose\s*\n+\s*[-*]?\s*([^\n#].*)/);
18255
- if (m && !/업데이트하세요/.test(m[1])) intent = m[1].trim().slice(0, 200);
18256
- }
18387
+ // 프로젝트 청사진 (1.9.308 UR-0055 2단계): brief 에서 의도/개요/방향이력 회수 (단일 출처)
18388
+ const brief = _loadBrief(root);
18389
+ const intent = (brief.purpose || brief.intro || '').slice(0, 200) || null;
18257
18390
  const ctx = {
18258
18391
  schemaVersion: 1,
18259
18392
  version: VERSION,
18260
- project: { root, intent },
18393
+ project: { root, name: brief.project, intent },
18394
+ brief: { intro: brief.intro || null, purpose: brief.purpose || null, features: brief.features || [], stack: brief.stack || [], latestDirection: (brief.directionHistory || []).slice(-1)[0] || null, filled: _briefFilled(brief) },
18261
18395
  currentTask: active ? { id: active.id, request: (active.request || '').slice(0, 200), status: active.status, nextAction: (active.nextAction || '').slice(0, 160) || null } : null,
18262
18396
  openRequests: { count: openReqs.length, items: openReqs.slice(0, 5).map(r => ({ id: r.id, text: (r.text || '').slice(0, 120) })) },
18263
18397
  recentDecisions,
@@ -18272,6 +18406,7 @@ function contextCmd(root, opts = {}) {
18272
18406
  const dm = s => isTty ? `\x1b[2m${s}\x1b[0m` : s;
18273
18407
  log(cy(`# leerness context (1.9.292) — 에이전트 온보딩 컨텍스트 (v${VERSION})`));
18274
18408
  if (intent) log(` 🎯 의도: ${intent}`);
18409
+ if (ctx.brief.intro || ctx.brief.features.length) log(dm(` 📘 청사진: ${ctx.brief.intro || ''}${ctx.brief.features.length ? ` · 기능 ${ctx.brief.features.length}` : ''}${ctx.brief.latestDirection ? ` · 최근방향 ${ctx.brief.latestDirection.slice(0, 50)}` : ''} (leerness brief show)`));
18275
18410
  log('');
18276
18411
  if (ctx.currentTask) {
18277
18412
  log(gr(`▶ 현재 작업: ${ctx.currentTask.id} — ${ctx.currentTask.request}`));
@@ -21458,6 +21593,7 @@ async function main() {
21458
21593
  // 1.9.278 (UR-0032): leerness state <show|start|record|verify|handoff> — .leerness/ 구조화 상태 substrate
21459
21594
  if (cmd === 'state') return stateCmd(arg('--path', process.cwd()), args[1], ...args.slice(2));
21460
21595
  if (cmd === 'context') return contextCmd(arg('--path', process.cwd()), { json: has('--json') });
21596
+ if (cmd === 'brief') return briefCmd(arg('--path', process.cwd()), args[1]);
21461
21597
  if (cmd === 'about' || cmd === 'identity') return aboutCmd({ json: has('--json') });
21462
21598
  // 1.9.281 (UR-0034): leerness policy <show|set|check> — 권한 등급 (opt-in enforced)
21463
21599
  if (cmd === 'policy') return policyCmd(arg('--path', process.cwd()), args[1], ...args.slice(2));
package/lib/mcp-tools.js CHANGED
@@ -86,5 +86,6 @@ module.exports = [
86
86
  { name: 'leerness_state_handoff', requiredTier: 'safe-write', description: '1.9.279 (UR-0031) — create_handoff / make_handoff. 현재 run 을 마감하고 다음 에이전트용 .leerness/handoff/latest.{md,json} 작성 (Claude→Goose→Codex 인수인계 표준). 인자: { path?, summary (required) }. 응답: { handoff, run }.', inputSchema: { type: 'object', properties: { path: { type: 'string' }, summary: { type: 'string' } }, required: ['summary'] } },
87
87
  { name: 'leerness_get_project_context', requiredTier: 'read-only', description: '1.9.292 (UR-0031) — get_project_context. 외부 에이전트가 작업 시작 전 단 1콜로 "지금 무엇을 알아야 하는가"를 파악하는 집약 컨텍스트. 여러 소스(현재 작업/미답 사용자 요청/최근 결정/활성 룰/next-actions/memory surface/프로젝트 의도)를 한 번에 구조화 회수. read-only. 인자: { path? }. 응답: { version, project, currentTask, openRequests, recentDecisions, activeRules, nextActions, memory }.', inputSchema: { type: 'object', properties: { path: { type: 'string' } } } },
88
88
  { name: 'leerness_about', requiredTier: 'read-only', description: '1.9.296 (UR-0030) — leerness 정체성/포지셔닝 회수. leerness 가 무엇인가: "AI 에이전트 운영 레이어"(실행기 아님) — 기억·정책·인수인계·검증·감사 5계층. read-only. 어떤 에이전트든 "이 도구가 무엇이고 무엇을 보완하는가"를 1콜로 파악. 응답: { identity, isNot, tagline, layers[], complements, entryPoints, surface }.', inputSchema: { type: 'object', properties: {} } },
89
- { name: 'leerness_honesty_check', requiredTier: 'read-only', description: '1.9.305 (사용자 명시) — AI 인식론적 정직성 점검. 주장/evidence 텍스트가 (1) 모르는 걸 아는 척(근거 없는 단정), (2) 검증 없는 섣부른 판단(추정+완료 결론), (3) 외부 정보 미수집(API/버전/스펙 언급+수집흔적 없음) 중 무엇에 해당하는지 휴리스틱 탐지. read-only. 에이전트가 자기 주장을 단언 전 self-check. 인자: { path?, taskId?, text? }. 응답: { ok, findings[], dimensions[], highCount }.', inputSchema: { type: 'object', properties: { path: { type: 'string' }, taskId: { type: 'string' }, text: { type: 'string' } } } }
89
+ { name: 'leerness_honesty_check', requiredTier: 'read-only', description: '1.9.305 (사용자 명시) — AI 인식론적 정직성 점검. 주장/evidence 텍스트가 (1) 모르는 걸 아는 척(근거 없는 단정), (2) 검증 없는 섣부른 판단(추정+완료 결론), (3) 외부 정보 미수집(API/버전/스펙 언급+수집흔적 없음) 중 무엇에 해당하는지 휴리스틱 탐지. read-only. 에이전트가 자기 주장을 단언 전 self-check. 인자: { path?, taskId?, text? }. 응답: { ok, findings[], dimensions[], highCount }.', inputSchema: { type: 'object', properties: { path: { type: 'string' }, taskId: { type: 'string' }, text: { type: 'string' } } } },
90
+ { name: 'leerness_brief', requiredTier: 'read-only', description: '1.9.308 (UR-0055) — 프로젝트 청사진 회수. 프로젝트 개요/소개/목적/기능/스택/아키텍처/성공기준/방향이력을 구조화 반환(show) 또는 복사용 blueprint 텍스트(export=true). read-only. 외부 에이전트가 "이 프로젝트가 무엇이고 어디로 가는가"를 1콜로 파악하거나, 신규 프로젝트 계획으로 복사. 인자: { path?, export? }. 응답(show): { project, intro, purpose, features[], stack[], directionHistory[], ... }.', inputSchema: { type: 'object', properties: { path: { type: 'string' }, export: { type: 'boolean' } } } }
90
91
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.306",
3
+ "version": "1.9.308",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3501,5 +3501,66 @@ total++;
3501
3501
  if (!ok) failed++;
3502
3502
  }
3503
3503
 
3504
+ // 1.9.307 회귀 (UR-0055 사용자명시): brief — 프로젝트 청사진 set/show/export + README 섹션 + 멱등 업데이트
3505
+ total++;
3506
+ {
3507
+ let ok = false;
3508
+ try {
3509
+ const bDir = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-brief-'));
3510
+ cp.spawnSync(process.execPath, [CLI, 'init', bDir, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3511
+ const run = (...a) => cp.spawnSync(process.execPath, [CLI, ...a], { cwd: bDir, encoding: 'utf8', timeout: 20000 });
3512
+ run('brief', 'set', '--path', bDir, '--intro', '할 일 관리 앱', '--purpose', '팀 생산성', '--features', '태스크CRUD, 알림');
3513
+ const briefMd = fs.readFileSync(path.join(bDir, '.harness', 'project-brief.md'), 'utf8');
3514
+ const readme = fs.readFileSync(path.join(bDir, 'README.md'), 'utf8');
3515
+ const setOk = /## Intro\n할 일 관리 앱/.test(briefMd) && /태스크CRUD/.test(briefMd) && readme.includes('<!-- leerness:project-brief:start -->') && /## 프로젝트 개요/.test(readme) && /할 일 관리 앱/.test(readme);
3516
+ // 멱등 업데이트: 방향 변경(--purpose 만 갱신) → intro/features 보존
3517
+ run('brief', 'set', '--path', bDir, '--purpose', '엔터프라이즈 확대');
3518
+ const md2 = fs.readFileSync(path.join(bDir, '.harness', 'project-brief.md'), 'utf8');
3519
+ const updateOk = /엔터프라이즈 확대/.test(md2) && /할 일 관리 앱/.test(md2) && /태스크CRUD/.test(md2);
3520
+ // README 섹션 중복 없음 (재sync)
3521
+ const readme2 = fs.readFileSync(path.join(bDir, 'README.md'), 'utf8');
3522
+ const noDup = (readme2.match(/<!-- leerness:project-brief:start -->/g) || []).length === 1;
3523
+ // export: 복사용 blueprint
3524
+ const exp = run('brief', 'export', '--path', bDir);
3525
+ const exportOk = exp.status === 0 && /Blueprint/.test(exp.stdout) && /신규 프로젝트 시작 가이드/.test(exp.stdout) && /엔터프라이즈 확대/.test(exp.stdout);
3526
+ ok = setOk && updateOk && noDup && exportOk;
3527
+ fs.rmSync(bDir, { recursive: true, force: true });
3528
+ } catch {}
3529
+ console.log(ok ? '✓ B(1.9.307) brief: 청사진 set→README+brief 동기화 + 멱등 업데이트 + export blueprint (UR-0055)' : '✗ brief 청사진 실패');
3530
+ if (!ok) failed++;
3531
+ }
3532
+
3533
+ // 1.9.308 회귀 (UR-0055 2단계): brief update --direction 이력 + context 통합 + MCP leerness_brief
3534
+ total++;
3535
+ {
3536
+ let ok = false;
3537
+ try {
3538
+ const b2 = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-brief2-'));
3539
+ cp.spawnSync(process.execPath, [CLI, 'init', b2, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3540
+ const run = (...a) => cp.spawnSync(process.execPath, [CLI, ...a], { cwd: b2, encoding: 'utf8', timeout: 20000 });
3541
+ run('brief', 'set', '--path', b2, '--intro', '앱', '--features', 'CRUD');
3542
+ run('brief', 'update', '--path', b2, '--direction', 'AI 자동분류 확대');
3543
+ run('brief', 'update', '--path', b2, '--direction', '모바일 지원 추가');
3544
+ const md = fs.readFileSync(path.join(b2, '.harness', 'project-brief.md'), 'utf8');
3545
+ const histOk = /## Direction History/.test(md) && /AI 자동분류 확대/.test(md) && /모바일 지원 추가/.test(md); // 이력 누적
3546
+ const readme = fs.readFileSync(path.join(b2, 'README.md'), 'utf8');
3547
+ const readmeOk = /최근 개발 방향 변경/.test(readme) && /모바일 지원 추가/.test(readme);
3548
+ const exp = run('brief', 'export', '--path', b2);
3549
+ const expOk = /개발 방향 이력/.test(exp.stdout) && /AI 자동분류 확대/.test(exp.stdout);
3550
+ // context --path 가 brief 노출
3551
+ const ctx = run('context', '--path', b2, '--json');
3552
+ const cj = JSON.parse(ctx.stdout);
3553
+ const ctxOk = cj.brief && cj.brief.intro === '앱' && cj.brief.features.includes('CRUD') && /모바일 지원/.test(cj.brief.latestDirection || '');
3554
+ // MCP leerness_brief
3555
+ const ml = cp.spawnSync(process.execPath, [CLI, 'mcp', 'serve'], { cwd: b2, encoding: 'utf8', timeout: 15000, input: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'leerness_brief', arguments: { path: b2 } } }) + '\n' });
3556
+ let mcpOk = false;
3557
+ try { const r = JSON.parse(ml.stdout.split('\n').filter(Boolean)[0]); const t = JSON.parse(r.result.content[0].text); mcpOk = t.directionHistory.length === 2 && t.features.includes('CRUD'); } catch {}
3558
+ ok = histOk && readmeOk && expOk && ctxOk && mcpOk;
3559
+ fs.rmSync(b2, { recursive: true, force: true });
3560
+ } catch {}
3561
+ console.log(ok ? '✓ B(1.9.308) brief 2단계: update --direction 이력누적 + context 통합 + MCP leerness_brief (UR-0055)' : '✗ brief 2단계 실패');
3562
+ if (!ok) failed++;
3563
+ }
3564
+
3504
3565
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
3505
3566
  if (failed > 0) process.exit(1);