Skip to content

HUG Agent

The hug agent implements human-in-the-loop review gates. When a pipeline reaches a type: gate phase with agent: hug, the agent assembles context from the workspace, creates a structured review on the HUG server, notifies reviewers, and polls for a verdict. The pipeline resumes based on the human’s decision.

The HUG agent can only be used on gate phases — it cannot be used as a standard phase agent. It requires a running HUG server and at least one configured reviewer.

For the full HUG system guide (server setup, reviewer configuration, notifications, examples), see Human Gate (HUG).


- name: arch-review
type: gate
agent: hug
depends_on: [architect]
commands:
- name: tests-pass
run: npm test
review:
reviewer: tech-lead
artifacts:
- .cliq/design/architecture.md
timeout: 8h

The HUG agent is used exclusively on type: gate phases. Review configuration is nested under the review: key.

FieldTypeRequiredDescription
namestringYesUnique phase name within the workflow
typestringYesMust be "gate"
agentstringYesMust be "hug"
rolestringYesRole file providing review guidelines and context
depends_onstring[]NoUpstream phases that must complete before this phase runs
commandsCommand[]NoPre-review validation commands — all must pass before review is created
reviewobjectYesReview configuration block (see Review Block Fields below)
FieldTypeRequiredDefaultDescription
reviewerstring | string[]YesNamed reviewer(s) from hug.reviewers in settings
artifactsstring[]No[]Files or globs to include in the review context
timeoutstringNo"24h"Auto-escalate duration (supports s, m, h, d)
remind_everystringNo(none)Re-notification interval — omit to notify once

Gate commands run first — all must pass before a review is created. Reviewers only see complete, valid work.

Human ActionGate VerdictPipeline Effect
ApprovePASSPipeline continues to next phase
Request ChangesROUTE:<target>Work routes to selected phase with feedback
RejectESCALATEPipeline halts — human intervention required
Timeout (no action)ESCALATEPipeline halts with “timed out” reason

All settings live under the hug key in settings.json:

KeyRequiredDefaultDescription
hug.server_urlYesURL of the HUG server
hug.tokenNoUser JWT (managed by cliq hub login)
hug.enable_chatNofalseEnable chat assistant on the review page
hug.enable_dynamic_review_uiNofalseEnable dynamic review UI rendering
hug.max_artifact_sizeNo50000Per-artifact character cap in LLM context
hug.max_total_artifact_sizeNo200000Total artifact character cap
hug.llmNoLLM configuration for chat (provider, model, api_key)
hug.reviewersNo[]Named reviewer individuals and groups

{
"data": {
"review_id": "rev-8f3a2b1c",
"reviewer": "alice",
"verdict_label": "approve",
"comment": "Architecture looks solid. Caching strategy is well-reasoned."
},
"text": "Review rev-8f3a2b1c: approved by alice"
}
FieldLocationDescription
review_iddata.review_idUnique identifier for the review
reviewerdata.reviewerName of the reviewer who rendered the verdict
verdict_labeldata.verdict_labelHuman-readable verdict ("approve", "request_changes", "reject", "timeout")
commentdata.commentReviewer’s written feedback

The HUG agent writes an audit trail to .cliq/reviews/{phase}-{review_id}.json containing the full review record — verdict, comments, timestamps, and reviewer identity.

When routing (Request Changes), the reviewer’s comment becomes routing context delivered to the target phase through the gate channel.

commands:
- name: show-verdict
run: 'echo "Reviewed by $(handoff.code-review.data.reviewer): $(handoff.code-review.data.verdict_label)"'

Standard review gate pattern — implement, validate, then get human approval.

phases:
- name: implement
agent: cursor
- name: code-review
type: gate
agent: hug
depends_on: [implement]
commands:
- name: tests
run: npm test
- name: lint
run: npm run lint
review:
reviewer: [tech-lead, security]
artifacts:
- src/**/*.ts
timeout: 8h
remind_every: 2h
- name: finalize
agent: git
action: create_pr
depends_on: [code-review]

Example: Single reviewer with short timeout

Section titled “Example: Single reviewer with short timeout”

A lightweight review gate for low-risk changes.

phases:
- name: implement
agent: cursor
- name: quick-review
type: gate
agent: hug
depends_on: [implement]
review:
reviewer: team-lead
artifacts:
- "*.md"
timeout: 2h
- name: deploy
agent: exec
depends_on: [quick-review]
commands:
- name: publish
run: npm publish

Chain multiple review gates for high-compliance workflows.

phases:
- name: implement
agent: cursor
- name: peer-review
type: gate
agent: hug
depends_on: [implement]
review:
reviewer: peer
artifacts:
- src/**/*
timeout: 4h
- name: security-review
type: gate
agent: hug
depends_on: [peer-review]
review:
reviewer: security-team
artifacts:
- src/**/*
- package-lock.json
timeout: 24h
remind_every: 8h
- name: finalize
agent: git
action: create_pr
depends_on: [security-review]

Terminal window
docker run -d --name hug-server \
-p 3100:3100 \
-e DATABASE_URL=postgres://user:pass@host:5432/hug \
-e HUG_JWT_SECRET=$(openssl rand -hex 32) \
-e HUG_ADMIN_KEY=$(openssl rand -hex 32) \
ghcr.io/elanamir/hug-server:latest

See HUG Server for full installation options (npm, Docker Compose, local dev).

If using CliqHub integration:

Terminal window
cliq hub login

For standalone servers, configure manually:

Terminal window
cliq settings hug.server_url http://localhost:3100 --global
echo '<jwt-token>' | cliq settings hug.token --stdin --global
Terminal window
cliq settings --json hug.reviewers '[{"name":"alice","channels":["slack:alice"]},{"name":"bob","channels":["slack:bob"]}]' --global
Terminal window
cliq doctor

cliq doctor checks:

  • HUG server is reachable at hug.server_url
  • JWT token is valid (when configured)
  • LLM provider is accessible (when enable_chat is true)