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
14 changes: 14 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ One logic, one place.
- Remove debug `print` / `console.log` before finishing
- Do not modify version numbers in `pyproject.toml` or `package.json` unless explicitly asked

## Agent Execution Rules

**Model selection** (by files touched): 0–1 → Haiku 4.5 · 2–9 → Sonnet 4.6 · 10+ → Sonnet + `advisor()` or Opus 4.7. Borderline: bias up.

**Escalation gates** — escalate one tier or surface to user when any triggers:
- Same problem failed ≥ 3 attempts
- Task touches ≥ 10 files
- Task type ∈ {Architecture · Counter-factual · Security threat modeling} → Opus or `advisor()`
- Unrequested code gen > 300 LoC → halt first

**Context management**: compact at **70%** (general) or **30–35%** (complex agentic). Behavioral signal (model seems lost) → `/compact` immediately. At 95%+: `/clear`.

**Source-Verify gate**: any cited number / benchmark / verbatim quote must be locatable via `grep -i <term> <source>`. If not found → remove or correct; never approximate.

## Git Workflow

### Commit Convention
Expand Down
54 changes: 50 additions & 4 deletions design/prototype/pages/annotation/annotation-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -649,17 +649,31 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
pageSubtitleReviewer: '請先選擇要審查的資料筆次,再進入審核作業頁。',
submitReviewLabel: '送出審核',
toastReviewSubmitted: '審核結果已送出。',
toastSelectDecision: '請完成每位標記員的審核決策'
toastSelectDecision: '請完成每位標記員的審核決策',
trialRoundLabelTpl: '試標回合 R{round}',
trialListCountTpl: '本回合清單 {total} 筆',
officialListLabel: '正式標記清單',
officialListCountTpl: '正式清單 {total} 筆'
},
en: {
pageSubtitleAnnotator: 'Select a sample to annotate, then open the annotation workspace.',
pageSubtitleReviewer: 'Select a sample to review, then open the review workspace.',
submitReviewLabel: 'Submit review',
toastReviewSubmitted: 'Review submitted.',
toastSelectDecision: 'Please complete a review decision for each annotator'
toastSelectDecision: 'Please complete a review decision for each annotator',
trialRoundLabelTpl: 'Trial round R{round}',
trialListCountTpl: 'This round list: {total} items',
officialListLabel: 'Official annotation list',
officialListCountTpl: 'Official list: {total} items'
}
};
function t(key) { return (I18N[CURRENT_LANG] || I18N.zh)[key] || key; }
function t(key, vars) {
var str = (I18N[CURRENT_LANG] || I18N.zh)[key] || key;
if (vars) {
Object.keys(vars).forEach(function(k) { str = str.replace('{' + k + '}', String(vars[k])); });
}
return str;
}

var toastTimer = null;
function showToast(msg, type) {
Expand All @@ -682,6 +696,21 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
sentence_pairs: { text: '句對任務(相似度 / 蘊含)', badgeClass: 'badge-task-type-pairs' }
};

var MATERIALIZED_RUN_CONTEXT = {
'TASK-015-A1': { round: null, total: 3180 },
'TASK-015-A2': { round: 2, total: 10 },
'TASK-015-A3': { round: null, total: 840 },
'TASK-015-A4': { round: null, total: 1400 },
'TASK-015-A5': { round: 1, total: 10 },
'TASK-015-A6': { round: null, total: 930 },
'TASK-015-R1': { round: null, total: 3180 },
'TASK-015-R2': { round: 2, total: 10 },
'TASK-015-R3': { round: null, total: 840 },
'TASK-015-R4': { round: null, total: 1400 },
'TASK-015-R5': { round: 1, total: 10 },
'TASK-015-R6': { round: null, total: 930 }
};

var TASKS_BY_ROLE = {
annotator: [
{
Expand Down Expand Up @@ -1561,6 +1590,22 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
return runType === 'official_run' ? 'badge-official' : 'badge-dry-run';
}

function getMaterializedRunContext(task) {
var meta = MATERIALIZED_RUN_CONTEXT[task.taskId] || {};
var total = (meta.total !== undefined && meta.total !== null) ? Number(meta.total) : (Array.isArray(task.samples) ? task.samples.length : 0);
if (task.runType === 'dry_run') {
var round = Number(meta.round) || 1;
return {
label: t('trialRoundLabelTpl', { round: round }),
countLabel: t('trialListCountTpl', { total: total })
};
}
return {
label: t('officialListLabel'),
countLabel: t('officialListCountTpl', { total: total })
};
}

function taskTypeBadgeClass(taskType) {
return (TASK_TYPE_META[taskType] && TASK_TYPE_META[taskType].badgeClass) || 'badge-task-type-default';
}
Expand Down Expand Up @@ -1607,7 +1652,8 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
var statusClass = task.dashboardStatusClass || 'badge-info';

title.textContent = task.title;
detail.textContent = task.dashboardDetail || '-';
var runContext = getMaterializedRunContext(task);
detail.textContent = [task.dashboardDetail || '-', runContext.label, runContext.countLabel].filter(Boolean).join(' · ');
taskType.textContent = task.dashboardTaskTypeText || (TASK_TYPE_META[task.taskType] && TASK_TYPE_META[task.taskType].text) || task.taskType;
taskType.className = 'badge ' + taskTypeBadgeClass(task.taskType);
runType.textContent = runTypeLabel(task.runType);
Expand Down
39 changes: 38 additions & 1 deletion design/prototype/pages/annotation/annotation-workspace.html
Original file line number Diff line number Diff line change
Expand Up @@ -3420,6 +3420,37 @@ <h2 class="image-modal-title" id="guidelineImageModalTitle">圖片預覽</h2>
]
};

var MATERIALIZED_RUN_CONTEXT = {
'TASK-015-A1': { round: null, total: 3180 },
'TASK-015-A2': { round: 2, total: 10 },
'TASK-015-A3': { round: null, total: 840 },
'TASK-015-A4': { round: null, total: 1400 },
'TASK-015-A5': { round: 1, total: 10 },
'TASK-015-A6': { round: null, total: 930 },
'TASK-015-R1': { round: null, total: 3180 },
'TASK-015-R2': { round: 2, total: 10 },
'TASK-015-R3': { round: null, total: 840 },
'TASK-015-R4': { round: null, total: 1400 },
'TASK-015-R5': { round: 1, total: 10 },
'TASK-015-R6': { round: null, total: 930 }
};

function getMaterializedRunContext() {
var meta = MATERIALIZED_RUN_CONTEXT[state.taskId] || {};
var total = (meta.total !== undefined && meta.total !== null) ? Number(meta.total) : SAMPLES.length;
if (state.runType === 'dry_run') {
var round = Number(meta.round) || 1;
return {
label: state.lang === 'en' ? ('Trial round R' + round) : ('試標回合 R' + round),
total: total
};
}
return {
label: state.lang === 'en' ? 'Official list' : '正式標記清單',
total: total
};
}

function applyTaskSampleContext() {
var contextSamples = TASK_SAMPLE_CONTEXTS[state.taskId];
if (!Array.isArray(contextSamples) || !contextSamples.length) return;
Expand Down Expand Up @@ -3720,6 +3751,12 @@ <h2 class="image-modal-title" id="guidelineImageModalTitle">圖片預覽</h2>
});
}

function renderSampleListHeader() {
var context = getMaterializedRunContext();
setText('sampleListTitle', t('sampleListTitle') + ' · ' + context.label);
setText('sampleListCount', t('sampleListCount', { n: context.total }));
}

function renderHistoryPanel() {
var container = el('historyContainer');
while (container.firstChild) { container.removeChild(container.firstChild); }
Expand Down Expand Up @@ -4224,7 +4261,7 @@ <h2 class="image-modal-title" id="guidelineImageModalTitle">圖片預覽</h2>
modalClose.setAttribute('aria-label', t('guidelineImageModalCloseAria'));
}

setText('sampleListCount', t('sampleListCount', { n: SAMPLES.length }));
renderSampleListHeader();

if (window.LabelSuiteSharedSidebar) {
window.LabelSuiteSharedSidebar.applyGlobalLanguage(lang);
Expand Down
Loading
Loading