---
id: wiki-2026-0508-goal
title: goal (Goal Definition in Software & Agents)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Goal Specification, Objective Function, Agent Goal]
duplicate_of: none
source_trust_level: A
confidence_score: 0.85
verification_status: applied
tags: [goal-setting, planning, agents, okr, project-management]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Markdown / Python
  framework: convention + agent planning libs
---

# goal (Goal Definition in Software & Agents)

## 매 한 줄
> **"매 'goal' 매 software-eng / agent context 의 매 measurable success criterion + termination condition"**. OKR 의 KR, RL 의 reward, agent 의 stop condition, project brief 의 north star — 매 모든 context 에서 매 same shape: _state X must hold_. 2026 LLM agent 시대 매 'goal' 의 설계 가 prompt engineering 의 most-leveraged part.

## 매 핵심

### 매 Goal anatomy
1. **Predicate**: state 가 hold 의 boolean function.
2. **Metric**: 진행도 의 measurable scalar.
3. **Deadline**: time bound.
4. **Constraints**: 매 do-not-violate (cost, safety).
5. **Owner**: 매 accountable entity.

### 매 Goal 의 levels
- **Strategic** (북극성, 분기): "$10M ARR by EoY".
- **Tactical** (epic, 매 sprint): "ship 3 enterprise features".
- **Operational** (PR, task): "reduce P95 latency from 800ms to 300ms".
- **Agent-step** (1 turn): "extract email from this PDF".

### 매 SMART 의 modern 개정
- Specific, Measurable, **Aligned** (was Achievable), Relevant, Time-boxed, **Verifiable** (new) — 매 LLM 의 self-check 가능.

### 매 응용
1. Project brief / `_brief.md` 의 "Why" + "Now" 섹션.
2. Agent system prompt 의 stop condition.
3. RL reward shaping.
4. PR description ("This PR achieves: ___").

## 💻 패턴

### Goal struct (TypeScript)
```typescript
interface Goal {
  id: string;
  description: string;
  predicate: () => Promise<boolean>;
  metric?: () => Promise<number>;       // higher = closer
  deadline?: Date;
  constraints: Constraint[];
  owner: string;
  parent?: string;                       // hierarchy
}

interface Constraint {
  type: 'budget' | 'latency' | 'safety';
  check: () => Promise<boolean>;
}
```

### Agent stop-condition
```python
async def run_agent(goal: Goal, max_steps=20):
    for step in range(max_steps):
        if await goal.predicate():
            return {"status": "achieved", "steps": step}
        for c in goal.constraints:
            if not await c.check():
                return {"status": "violated", "constraint": c.type}
        action = await llm_plan(goal, history)
        history.append(await execute(action))
    return {"status": "exhausted", "steps": max_steps}
```

### OKR YAML
```yaml
# goals/2026-Q2.yaml
objective: "Make Acme the default CRM for 50-person SMBs"
key_results:
  - id: arr
    description: "Reach $2M ARR"
    metric: arr_usd
    target: 2_000_000
    current: 1_240_000
  - id: nps
    description: "NPS ≥ 50"
    metric: nps_score
    target: 50
    current: 38
  - id: churn
    description: "Monthly churn < 2%"
    metric: monthly_churn
    target: 0.02
    direction: minimize
```

### LLM goal-prompt template
```text
You are working toward this goal:
<goal>{description}</goal>

You must terminate when ALL of these are true:
{predicate_checklist}

You must NOT violate:
{constraints}

After each action, output `<self-check>...</self-check>` where you state
whether the goal predicate is now true and why.
```

### Hierarchical decomposition (HTN-style)
```python
def decompose(goal: Goal) -> list[Goal]:
    # 매 LLM 또는 rule-based
    if goal.id == "ship_feature_X":
        return [
            Goal("design_doc", ..., parent=goal.id),
            Goal("api_impl", ..., parent=goal.id),
            Goal("ui_impl", ..., parent=goal.id),
            Goal("docs_update", ..., parent=goal.id),
        ]
    return [goal]
```

### Verifiable goal check
```typescript
const goals: Goal[] = [{
  id: 'p95_latency',
  description: 'p95 < 300ms for /search',
  predicate: async () => {
    const r = await fetch('https://prom/api/v1/query?query=histogram_quantile(0.95,rate(http_dur_bucket{route="/search"}[5m]))');
    const v = +(await r.json()).data.result[0].value[1];
    return v < 0.3;
  },
  constraints: [],
  owner: 'eng@acme',
}];
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| Company-level | OKR (1 obj, 3-5 KRs, quarterly) |
| Team sprint | Goal + acceptance criteria checklist |
| LLM agent run | predicate + max-step + cost budget |
| RL training | dense reward + sparse goal + early stopping |
| Personal dev | weekly review, 매 1-2 active goals only |

**기본값**: 매 written goal + measurable predicate + deadline + 매 weekly check-in. 매 매 unmeasurable goal 의 X.

## 🔗 Graph
- 부모: [[Project-Management]] · [[Agent-Planning]]
- 변형: [[OKR]] · [[SMART-Goal]] · [[Reward-Function]]
- 응용: [[_brief]] · [[Agent-Stop-Condition]] · [[Sprint-Planning]]
- Adjacent: [[KPI]] · [[North-Star-Metric]]

## 🤖 LLM 활용
**언제**: goal decomposition draft, predicate code generation, OKR phrasing.
**언제 X**: 매 strategic priority 의 결정 — 매 founder/leadership 의 own.

## ❌ 안티패턴
- **Vague goal**: "improve UX" — 매 unverifiable. Use metrics.
- **Too many goals**: > 5 active = 0 active. Force prioritization.
- **No constraints**: agent 가 매 cost/safety 의 무시 → catastrophic.
- **Goal-metric mismatch**: Goodhart's law — metric 만 game 됨. Pair with qualitative review.
- **Set-and-forget**: 매 check-in 없으면 매 3개월 wasted.

## 🧪 검증 / 중복
- Verified (Doerr "Measure What Matters", Anthropic agent design notes, RL textbooks).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — goal anatomy + agent stop condition |
