Skip to content

Commit d32e6a6

Browse files
committed
개선: 현금흐름에도 임계값 앵커를 주고 반증 판정의 오탐을 고친다
실제 답변 세 건을 읽고 찾은 것이다. 현금 질문 답변이 "사이클이 꺾이면 잉여현금흐름은 다시 음수가 될 수 있다" 에서 멈췄다. 옳은 말이지만 임계값이 없으면 지켜볼 수가 없다. 손익에는 관측 마진 앵커를 줬는데 현금흐름에는 같은 것이 없어서 생긴 비대칭이었다. 당기 설비투자와 조회 기간 최저 영업현금흐름만 써서 두 임계값을 만든다. 여기서도 가정을 지어내지 않는다. 이미 설비투자를 못 덮고 있으면 없는 여유를 말하지 않는다. 실측. 삼성전자 현금흐름 6 개년 조회에서 설비투자 47.5조원이 경계선이고 지금 85.3조원이라 37.8조원 여유가 있으며, 2023FY 수준 44.1조원으로 돌아가면 잉여현금흐름이 -3.4조원이 된다는 문장이 나온다. 측정기의 반증 판정 어휘가 좁아 오탐이 났다. 답변이 "이 판단이 틀리려면" 절과 반증 표 두 개를 내놓았는데 "틀렸" 만 보느라 빠짐으로 셌다. 없는 결함을 보고하는 측정기는 측정기가 아니다. 같은 뜻의 어미와 표현을 함께 본다. 테스트 24 건.
1 parent 3689a97 commit d32e6a6

3 files changed

Lines changed: 109 additions & 2 deletions

File tree

‎src/dartlab/ai/tools/panelInsight.py‎

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,65 @@ def observedRangeAnchors(summary: dict[str, Any]) -> list[str]:
480480
return notes
481481

482482

483+
def cashFlowAnchors(summary: dict[str, Any]) -> list[str]:
484+
"""현금흐름이 어디까지 내려가면 설비투자를 못 덮는지 임계값으로 적는다.
485+
486+
실측(2026-08-06): 현금 질문 답변이 "사이클이 꺾이면 잉여현금흐름은 다시 음수가 될 수
487+
있다" 에서 멈췄다. 옳은 말이지만 임계값이 없으면 지켜볼 수가 없다. 손익에는 관측 마진
488+
앵커를 줬는데 현금흐름에는 같은 것이 없어서 생긴 비대칭이다.
489+
490+
여기서도 가정을 지어내지 않는다. 당기 설비투자와 조회 기간에 실제로 겪은 최저
491+
영업현금흐름만 쓴다.
492+
493+
Args:
494+
summary: `Company.panel` tool 결과의 summary. 현금흐름표가 아니면 빈 목록이다.
495+
496+
Returns:
497+
list[str]: 사람이 읽는 한 줄 노트 목록.
498+
499+
Example:
500+
`notes = cashFlowAnchors(summary)`
501+
"""
502+
periods = [str(p) for p in (summary.get("periods") or [])]
503+
timeseries = [row for row in (summary.get("timeseries") or []) if isinstance(row, dict)]
504+
if len(periods) < 2 or not timeseries:
505+
return []
506+
507+
indexed = _seriesByKey(timeseries)
508+
operating = _pick(indexed, _OCF_KEYS)
509+
capex = _pick(indexed, _CAPEX_KEYS)
510+
if operating is None or capex is None:
511+
return []
512+
513+
latest = periods[0]
514+
spendNow = _numeric(capex.get("values"), latest)
515+
flowNow = _numeric(operating.get("values"), latest)
516+
if spendNow is None or flowNow is None:
517+
return []
518+
spendNow = abs(spendNow)
519+
520+
notes: list[str] = []
521+
if flowNow > spendNow:
522+
notes.append(
523+
f"영업활동현금흐름이 당기 설비투자 {_formatAmount(spendNow).lstrip('+')} 아래로 내려가면 "
524+
f"잉여현금흐름이 음수가 됩니다. 지금은 {_formatAmount(flowNow).lstrip('+')}이라 "
525+
f"{_formatAmount(flowNow - spendNow)} 여유가 있습니다."
526+
)
527+
528+
history = [(period, _numeric(operating.get("values"), period)) for period in periods]
529+
history = [(period, value) for period, value in history if value is not None]
530+
if len(history) >= _MIN_PERIODS_FOR_POSITION:
531+
lowPeriod, lowValue = min(history, key=lambda item: item[1])
532+
if lowPeriod != latest:
533+
notes.append(
534+
f"영업활동현금흐름이 조회 기간 최저인 {lowPeriod} 수준"
535+
f"({_formatAmount(lowValue).lstrip('+')})으로 돌아가면 당기 설비투자 기준 "
536+
f"잉여현금흐름은 {_formatAmount(lowValue - spendNow)}입니다. "
537+
f"다른 조건이 같다고 둔 산술이며 전망이 아닙니다."
538+
)
539+
return notes
540+
541+
483542
def contextMarkdown(dcrBadge: dict[str, Any] | None, industryBadge: dict[str, Any] | None) -> str:
484543
"""이미 계산돼 붙어 있는 신용 등급과 산업 위치를 답변 표면으로 끌어올린다.
485544
@@ -545,7 +604,7 @@ def insightMarkdown(summary: dict[str, Any]) -> str:
545604
notes = positionNotes(summary)
546605
bridge = profitBridge(summary)
547606
cash = cashFlowPattern(summary)
548-
anchors = observedRangeAnchors(summary)
607+
anchors = observedRangeAnchors(summary) + cashFlowAnchors(summary)
549608
if not rows and not notes and not bridge and not cash and not anchors:
550609
return ""
551610

‎tests/ai/runners/brokerReachProbe.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,23 @@ def _malformedArgs(name: str, payload: Any) -> str | None:
7878
_QUALITY_MARKERS: dict[str, tuple[str, ...]] = {
7979
"table": ("|---", "| ---"),
8080
"counterEvidence": ("반대", "반증", "다만", "그러나", "리스크", "약점", "부정적"),
81-
"falsifier": ("바뀌", "틀렸", "뒤집", "무효", "성립하지 않", "가정이 깨"),
81+
# 실측(2026-08-06): 목록이 좁아 오탐이 났다. 답변이 "이 판단이 틀리려면" 절과 반증 표
82+
# 두 개를 내놓았는데 "틀렸" 만 보느라 빠짐으로 셌다. 없는 결함을 보고하는 측정기는
83+
# 측정기가 아니다. 같은 뜻의 어미와 표현을 함께 본다.
84+
"falsifier": (
85+
"바뀌",
86+
"틀렸",
87+
"틀리려",
88+
"틀린다",
89+
"뒤집",
90+
"무효",
91+
"성립하지 않",
92+
"가정이 깨",
93+
"무너진",
94+
"깨지는",
95+
"반증",
96+
"tripwire",
97+
),
8298
"comparison": ("대비", "동종", "업종 평균", "경쟁", "peer", "상위", "하위", "백분위"),
8399
"nextCheck": ("다음", "확인할", "지켜볼", "모니터", "추가 확인", "후속"),
84100
"observationSplit": ("관측", "사실", "해석", "판단", "의미"),

‎tests/ai/test_panel_insight.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytest
1010

1111
from dartlab.ai.tools.panelInsight import (
12+
cashFlowAnchors,
1213
cashFlowPattern,
1314
contextMarkdown,
1415
derivedRows,
@@ -227,6 +228,37 @@ def testFreeCashFlowSubtractsCapexAsMagnitude() -> None:
227228
assert fcf["cells"][2].startswith("-15.0"), "영업 현금이 설비투자를 못 덮으면 음수여야 한다"
228229

229230

231+
def testCashFlowAnchorGivesTheThresholdNotJustAWarning() -> None:
232+
"""현금흐름이 어디까지 내려가면 잉여현금흐름이 음수가 되는지 숫자로 말한다.
233+
234+
실측(2026-08-06): 현금 질문 답변이 "사이클이 꺾이면 다시 음수가 될 수 있다" 에서
235+
멈췄다. 옳은 말이지만 임계값이 없으면 지켜볼 수가 없다. 손익에만 관측 앵커를 주고
236+
현금흐름에는 안 준 비대칭이 원인이었다.
237+
"""
238+
summary = _statement(
239+
cash_flows_from_operating_activities={"2025FY": 85e12, "2024FY": 73e12, "2023FY": 44e12},
240+
purchase_of_property_plant_and_equipment={"2025FY": 47e12, "2024FY": 53e12, "2023FY": 60e12},
241+
)
242+
243+
notes = cashFlowAnchors(summary)
244+
245+
assert notes, "영업현금흐름과 설비투자가 다 있으면 임계값을 낼 수 있어야 한다"
246+
assert any("아래로 내려가면" in note for note in notes)
247+
assert any("2023FY" in note and "전망이 아닙니다" in note for note in notes)
248+
249+
250+
def testCashFlowAnchorSkipsThresholdWhenAlreadyNegative() -> None:
251+
"""이미 설비투자를 못 덮고 있으면 여유 문장을 만들지 않는다. 없는 여유를 말하면 안 된다."""
252+
summary = _statement(
253+
cash_flows_from_operating_activities={"2025FY": 40e12, "2024FY": 73e12, "2023FY": 44e12},
254+
purchase_of_property_plant_and_equipment={"2025FY": 60e12, "2024FY": 53e12, "2023FY": 60e12},
255+
)
256+
257+
notes = cashFlowAnchors(summary)
258+
259+
assert not any("여유가 있습니다" in note for note in notes)
260+
261+
230262
def testCashFlowSignPatternIsRead() -> None:
231263
"""영업 양수, 투자 음수, 재무 음수는 성숙한 현금 창출 구조에서 흔한 조합이다."""
232264
summary = _statement(

0 commit comments

Comments
 (0)