in reviewhumanPR #333Negotiation
JANG: delegate multi-term negotiation in a Lab marketplace, with mandate-violation, tampered-agreement, no-ZOPA and service-down checks
[JANG](https://github.com/byujan/JANGmarket) is negotiation infrastructure for autonomous agents. An owner signs a mandate saying which line their agent may not cross on each term.
Author
@Hendrick-Jung
github profile →- Status
- In review
- Opened on
- Nov 10
- Branch
- integration/jang-negotiation
Description
The pitch.
## Summary
[JANG](https://github.com/byujan/JANGmarket) is negotiation infrastructure for autonomous agents. An owner signs a **mandate** saying which line their agent may not cross on each term. A buyer's agent and a seller's agent then exchange offers across several terms at once. JANG enforces each mandate on every offer and accept, never shows it to the counterparty, and signs the agreed package with Ed25519.
This PR adds `examples/jang/`. It is a Lab marketplace that delegates negotiation to a separately running JANG service. Town handles discovery, messaging and faults, escrow, payment and reputation. The PR contains:
- adapter roles
- five validated scenarios, including three boundary or failure cases and one negative control
- a Claude-negotiator run
- a parity check of the strategy port against JANG's TypeScript original
- a CI-safe test
## Integration
- **Subject:** [`byujan/JANGmarket@4fb4eca`](https://github.com/byujan/JANGmarket/commit/4fb4eca), hosted separately with `npm run dev` on `:3939` and its in-memory store. No database or credentials are needed.
- **Interface:** JANG's agent REST API: `/api/health`, `/api/agents`, `/api/mandates`, `/api/sessions`, plus `…/offers`, `…/accept` and `/api/agreements/{id}`.
- **Roles:** `jang_seller` and `jang_buyer` each hold one JANG agent key and lodge a mandate signed in Python by the owner's own Ed25519 key.
- Only `{session_id, offer_id}` turn signals and the signed agreement travel through Town, so mandates never do.
- Before any escrow is held, each side verifies JANG's signature against the key from `/api/health` and audits the terms against its own mandate.
- Every JANG call and refusal is an attributed event. JANG errors become events rather than exceptions.
- **Strategy:** JANG's REST API has no server-side negotiator, so the roles run `jang_strategy.decide`, a Python port of JANG's `agents/rule-strategy.ts`. `jang_claude.yaml` lets Claude make every buyer move through `claude -p` instead.
- **Fixtures:** owners, mandates, the TV item and the adapter roles belong to this example. JANG is the only participant developed independently of Town.
## Reproduce
- Town: `6f9a7c0` (main), evaluator `lab-0.2.6`, Python 3.14 (CI covers 3.11 and 3.12).
- JANG: `4fb4eca`, Node 24.
```bash
# JANG (separate checkout)
git clone https://github.com/byujan/JANGmarket && cd JANGmarket && git checkout 4fb4eca
npm install && npm run dev # leave running on :3939
# Town, from this branch
python3 -m venv .venv && . .venv/bin/activate && pip install -e '.[dev]'
nandatown run examples/jang/jang_market.yaml --out runs
python examples/jang/verify_bundle.py runs/<run id>
bash examples/jang/run_all.sh # all scenarios, each bundle verified; --claude adds the Claude run
python -m pytest -q tests/test_example_jang.py # no JANG needed
```
`JANG_URL` overrides the address. `JANG_SIGNER=ts JANG_REPO=…` signs with JANG's own TypeScript `signMandate` as a cross-check. `examples/jang/README.md` has the parity regeneration steps.
## Results and limitations
Observed with Town `6f9a7c0`, JANG `4fb4eca`, signer `python`. All bundles are in `examples/jang/evidence/` and pass `verify_bundle.py`.
| Run | Negotiators | Expected | Verdict | Observed | Bundle fingerprint |
| --- | --- | --- | --- | --- | --- |
| `jang_market` | rule | all 9 stages pass | **PASSED** | agreed USD 1,200 · 18 days · 36-month warranty · no soundbar, in 10 offers; duplicate turn and delivery absorbed | `sha256:0f6ce4c91262bd51…` |
| `jang_mandate_violation` | rule | refused with 422, then recover | **PASSED** | 422 `MANDATE_VIOLATION` on dimensions `*`, `price` (no limit recorded); same USD 1,200 agreement then verified and settled | `sha256:b8cd6ac8cb602eab…` |
| `jang_tampered_agreement` | rule | tamper rejected, no money moves | **PASSED** | buyer: `signature_ok: false`, `within_mandate: true`, so rejected; no escrow, payment or delivery | `sha256:938bf01c14db38fd…` |
| `jang_tampered_agreem
…Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/333/head:pr-333
git checkout pr-333