> ## Documentation Index
> Fetch the complete documentation index at: https://docs.platform.nora.my/llms.txt
> Use this file to discover all available pages before exploring further.

# nora causal

> 폴더별 인과 그래프 — 설정, 부트스트랩, 스테이지 리뷰, 라이브 승인.

Nora 의 인과 그래프가 **폴더별**: 문서 폴더에 그래프 붙임, 그 문서에서 인과 트리플을 **staged** 영역으로 추출, 그 다음 **live** 로 승인.

`causal` CLI 가 staged/live 워크플로우 표면. 그래프가 문서에서 부트스트랩; 좋은 트리플 승인; 승인된 (라이브) 것만 검증과 추론에 사용.

## 명령

| 명령                              | 설명                                |
| ------------------------------- | --------------------------------- |
| `causal get <folder>`           | 폴더의 전체 그래프 fetch (LIVE + STAGED). |
| `causal settings show <folder>` | 폴더 그래프 설정 + 스테이지 통계 인쇄.           |
| `causal settings set <folder>`  | 그래프 설정 업데이트.                      |
| `causal bootstrap <folder>`     | 인과 트리플을 STAGED 로 추출.              |
| `causal refresh <folder>`       | 델타를 STAGED 로 재계산.                 |
| `causal approve <folder>`       | STAGED 로우를 LIVE 로 프로모트.           |
| `causal reject <folder>`        | STAGED 로우를 프로모트 없이 드롭.            |

폴더 식별자가 문서 폴더 태그 (예: `billing`, `product-docs`).

## `causal get`

```bash theme={null}
nora causal get billing
```

전체 그래프 인쇄:

* `live_nodes` 와 `live_edges` — 검증과 추론에 사용.
* `staged_nodes` 와 `staged_edges` — 리뷰 대기.

구조화 출력에 `--json` 추가.

흔한 빠른 체크:

```bash theme={null}
nora causal get billing --json | jq '{live: .live_nodes | length, staged: .staged_nodes | length}'
```

## `causal settings show` / `set`

```bash theme={null}
nora causal settings show billing
```

설정 + 스테이지 카운트 표시.

```bash theme={null}
nora causal settings set billing \
  --connection documents_folder:billing \
  --retrieval-preset high-precision \
  --dedup-policy merge \
  --auto-restage true
```

넘긴 플래그만 변경.

* `--connection <kind:id>` — 그래프를 특정 데이터 소스에 연결 (예: `documents_folder:billing`).
* `--retrieval-preset <preset-id>` — 추출이 컨텍스트 끌어오는데 쓰는 프리셋.
* `--dedup-policy <policy>` — 중복 처리 방식 (`merge`, `keep_newer`, `keep_older`, `keep_all`).
* `--auto-restage true|false` — 연결된 소스 변경 시 자동 재-부트스트랩.

## `causal bootstrap`

```bash theme={null}
nora causal bootstrap billing --model gpt-4o
```

폴더의 모든 문서에서 인과 트리플을 STAGED 로 추출. `approve` 할 때까지 LIVE 로 아무것도 안 감.

* `--model <m>` — 추출에 쓰는 모델. 워크스페이스 기본이 기본.

부트스트랩이 멱등 — 이미 채워진 폴더에 재실행이 LIVE 데이터 잃지 않음. 재추출이 새 STAGED 로우 생성; 기존 LIVE 는 그대로.

새 폴더: bootstrap → 앱에서 STAGED 영역 리뷰 → 좋은 것 승인. 기존 폴더: `refresh` 가 보통 원하는 것.

## `causal refresh`

```bash theme={null}
nora causal refresh billing
```

델타만 재계산 — 마지막 부트스트랩 이후 추가된 새 문서, 변경된 기존 문서. 전체 부트스트랩보다 저렴.

Refresh 출력이 STAGED 에 착지. 기존 LIVE 그대로.

`--auto-restage` 가 안 맞으면 스케줄로 (또는 문서 변경으로 트리거) 실행.

## `causal approve` / `reject`

```bash theme={null}
# 모든 STAGED 로우 승인
nora causal approve billing

# 특정 로우만 승인
nora causal approve billing --ids node_1,edge_a,node_5

# 나머지 거부
nora causal reject billing
```

* `--ids <id,…>` — 특정 스테이지 로우 ID. 모든 STAGED 액션은 생략.

`approve` 후:

* 로우가 LIVE 로 이동.
* 검증이 즉시 그것들 사용 시작.
* STAGED 는 이 명령이 만지지 않은 것 여전히 담음.

`reject` 가 프로모트 없이 로우 드롭. 다음 부트스트랩이나 refresh 로 재생성 가능.

## 레시피

### CLI 로 폴더 엔드투엔드 부트스트랩

```bash theme={null}
folder="billing"

# 1. 설정
nora causal settings set $folder \
  --connection documents_folder:$folder \
  --retrieval-preset high-precision \
  --auto-restage true

# 2. STAGED 로 추출
nora causal bootstrap $folder

# 3. 리뷰 (보통 앱에서), 그 다음 스테이지된 모든 것 벌크 승인
nora causal approve $folder

# 4. 쿼리가 그래프 사용하는지 검증
nora retrieval search "some question" --filters '{"tag":"'$folder'"}' --include-subgraph
```

### CI: STAGED 너무 크면 실패

무제한 백로그 방지:

```bash theme={null}
threshold=200
staged=$(nora causal get billing --json | jq '.staged_nodes | length')
if [ "$staged" -gt "$threshold" ]; then
  echo "STAGED 백로그 너무 큼 ($staged > $threshold). 리뷰 필요."
  exit 1
fi
```

### 사람 리뷰 후 선택 승인

리뷰 워크플로우가 외부 시스템에서 로우 ID 로 승인 표시한다 가정. 벌크 승인:

```bash theme={null}
ids=$(cat approved-ids.txt | tr '\n' ',' | sed 's/,$//')
nora causal approve billing --ids "$ids"
```

### 감사용 LIVE 그래프 스냅샷

```bash theme={null}
nora causal get billing --json | jq '{live_nodes, live_edges}' > audit/billing-graph-$(date +%Y%m%d).json
```

## STAGED / LIVE 모델

인과 추출이 최선 노력이라 두 스테이지 모델 존재 — 모델이 제안, 여러분이 처리. LIVE 직접 편집이 CLI 에서 허용 안 됨 (그건 앱의 그래프 캔버스 사용). 하지만 벌크 승인/거부가 CLI 가 위한 것.

라이브 그래프 손 편집 원하면 — 특정 엣지 추가, 잘못된 노드 제거 — 앱에서. CLI 의 역할은 벌크 부트스트랩/refresh/승인.

## 관련

* [인과 그래프 개요](/ko/build/causal-graph/overview) — 개념과 유스케이스.
* [에이전트 답변 검증](/ko/build/causal-graph/verification) — LIVE 그래프 사용 방법.
* [`nora retrieval`](/ko/cli/retrieval) — `--include-subgraph` 이 그래프 써서 검색 확장.
