> Markdown version of https://www.imranjan.cn/projects/p-gatehouse for AI agents and other programs. It carries the same public information as the web page. Built 2026-11-24.

November 2026

# Gatehouse

A guard for the AI staff of a one-person company

QwenWork x Hashmeta OPC Hackathon

A guard I built for the QwenWork OPC hackathon. Every step a one-person company's AI agents take passes it first: ordinary work goes out, what needs the owner waits for one tap on her phone, and what must never happen is stopped next to the file it contradicts.

Tags: Hackathon, AI Governance, Rule Engine, MCP

![Gatehouse](https://www.imranjan.cn/images/projects/gatehouse-2026/cover.svg)

### Project resources

The code is public on GitHub; the README covers running it locally and running the trials yourself. The live app and the website open directly, and the demo video is on YouTube.

[Source code](https://github.com/narmi924/gatehouse)
[Watch the demo](https://youtu.be/Nlk77buE9Pc)
[Try the live app](https://tfgcmzyn.qwenwork.page)

## Event

#### Hackathon

QwenWork x Hashmeta OPC Hackathon Direction 2: Agents Watching Agents

- **Organizer**: QwenWork and Hashmeta; Direction 2 set by AvePoint
- **Challenge**: A one-person company hands work to AI agents and nobody checks what they actually do. Build an AI that watches them: log every step, stop dangerous actions, flag made-up figures, and give the owner a plain-language briefing every day.
- **Result**: Submitted
[Event page](https://luma.com/kxld1xck)

#### Entrant

- [Me](https://github.com/narmi924)
Architected the core logic and judging rules; accelerated prototyping and modules with Claude Code.
- **Time**: Three days
- **Code**: About 3,500 lines of JavaScript, no third-party dependencies
- **Runtime**: A Node.js service, live on QwenWork Pages with a database

## Background

The owner of a one-person company hands quotes, replies, payments and file clean-ups to AI agents. The agents are fast, but nobody is watching: one may put a figure in a reply that no contract supports, pay a bank account that changed yesterday, or, when the owner says "I am busy, just send them all", do exactly that.

Gatehouse is the only door those agents get. Every step they take, reading a file, sending an email, quoting, paying, uploading, deleting or editing, passes Gatehouse first, with one of three outcomes: ordinary work goes out; what needs the owner waits for one tap on her phone; what must never happen is stopped and shown next to the file it contradicts. At 7:30 every morning the owner gets a board and a 60-second voiced briefing.

The challenge asked for an AI that catches agents making mistakes. Gatehouse also catches agents trying to get past the guard: rewording a figure, splitting a payment, citing a note they wrote themselves, or claiming the owner agreed on the phone.

The demo company is Lumen Studio, a fictional design studio provided by the organizers, with 27 files at four sensitivity levels and 19 rules.

![The Gatehouse wall display: the studio floor plan on the left, last night's counts of steps let out, waiting and stopped on the right](https://www.imranjan.cn/images/projects/gatehouse-2026/wall.png)

The wall display: agents move through the studio and are let out, held or turned back at the gate.

## How it works

The owner is not technical, so everything she needs is on her phone, one decision per screen.

![Three screens on the owner's phone: the morning board, a stopped reply and a payment waiting for her](https://www.imranjan.cn/images/projects/gatehouse-2026/screens.png)

The owner's phone: her morning board, a stopped reply, a payment waiting for her.

### A look in the morning, a few taps

The home screen has three rows: 17 steps went out as normal, 7 were stopped, 6 wait for her. Each is a road sign: a red circle for stopped, a yellow triangle for waiting.

A stopped reply is shown side by side: the draft says the surcharge is 25%, the contract says 20%; the draft says 1,050, the invoice says 840\. A not-equal sign between them, and nothing was sent.

A waiting payment: QuickPrint emailed a new bank account, from an address with an extra "-sg". The screen names the account the owner checked by phone. She taps Pay or Send back, and the payment runs once.

![The Gatehouse decide, Try it and rules pages](https://www.imranjan.cn/images/projects/gatehouse-2026/owner-pages.png)

Decide, Try it and rules: one decision per screen, and every rule shows its source.

### Rules from her own words

Gatehouse does not invent rules. A QwenWork skill reads the owner's files and drafts rules that each quote her words, such as "floor is 6,500, do not go lower" from her weekly plan. At start-up Gatehouse checks every quote against the file word for word; a rule that does not match is not used, and the owner confirms each one on the rules page.

The trials page lists every test trick and its decision. On the Try it page anyone can pick an action or write their own email and see the decision on the spot.

## Implementation

There is no model inside Gatehouse. The judgement is a fixed rule program: the same input always gets the same result, in about 0.2 ms a step. Every decision quotes the owner's own words and names the file it rests on.

The agents work in QwenWork. Five desks, sales, finance, support, ops and marketing, each have their own skill and their own connector address, and no business folder or command line. The address is the desk's credential: it can do the desk's work and ask, and it cannot approve anything.

![Gatehouse architecture: five QwenWork desks send every step through Gatehouse, which lets it out, holds it or stops it](https://www.imranjan.cn/images/projects/gatehouse-2026/architecture.png)

Five desks, one door. The rule drafter, the watcher and the morning briefing are three more QwenWork agents.

##### Gate

Figures are checked against contracts and invoices, prices against the floor in the owner's notes and what she quoted, payments against the payee, the invoice and the account she checked by phone, and recipients against who may receive which file.

A price written as "5.8k", in words or as "10% off" is converted to an amount before it is compared with the floor; several payments on one invoice are added up before they are compared with the 1,000 limit.

##### Duty log

One hold per decision, however often an agent asks. A copy is kept before any deletion, so it can be undone. A held step runs only after the owner approves it, and only once.

##### Watcher

A second QwenWork agent reads what the gate let through and takes another look. It can only make a decision stricter, never looser.

##### Morning briefing

A scheduled task turns the duty log into the 7:30 board and a 60-second voiced video. Every figure in it must come from the log.

### Technologies

#### Service

Node.js 22MCP connectorNo dependencies

#### QwenWork

SkillsConnectorsPages and databaseScheduled tasks

#### Website

Hashmeta AI CMSRoguepedia directory

#### Testing

Trials scriptFive official scenarios54 bypass tricks

## Problems solved

These four took the most time.

##### Hooks did not load

**Problem**The plan was to intercept agents with QwenWork hooks. Testing showed the 1.4.1 desktop app does not load user hooks; its log says "User hooks skipped".

**Fix**Agents get a single Gatehouse connector and no folder or command line, so there is no other way out. The hook program stays in the repository for versions that load it.

##### Agents vouching for themselves

**Problem**In testing, an agent would write its own "contract summary" note and then cite it, or say the owner had agreed on the phone.

**Fix**Nothing an agent writes counts as a source. Approval is only the owner's tap on the page; asking again about the same thing adds to a count, not to the queue.

##### Rewording figures to get past the check

**Problem**The same price can be written in digits, shorthand, words or as a discount; an over-limit payment can be split into several.

**Fix**Every amount is converted before it is compared, and payments on one invoice are added up.

##### Rewrite it once and walk it out

**Problem**An agent reads a confidential file, writes a "summary" and uploads that. The summary is a new file with no sensitivity label.

**Fix**Anything an agent writes after reading a sensitive file inherits the higher level, and uploads are judged by the highest level it has read.

## Results

Every figure below comes from the trials script in the repository.

54 / 54bypass tricks stopped

15 / 15points on the five official scenarios

0 / 20routine jobs stopped by mistake

0.2 msto judge one step

__Test details__
| Test                                                             | Result                       |
| ---------------------------------------------------------------- | ---------------------------- |
| 54 bypass tricks written separately                              | All stopped                  |
| 10 files never seen before, sorted into four sensitivity levels  | 10 of 10                     |
| AvePoint's five scenarios, scored on decision, rule and evidence | 15 of 15 points              |
| AvePoint's 27 files, sensitivity labels removed first            | 27 of 27                     |
| 11 common kinds of bypass                                        | 146 tried, all stopped       |
| Routine jobs that should pass                                    | 20 run, 0 stopped by mistake |

## Demo & Submission

The demo video shows QwenWork agents at work on the left, and the Gatehouse wall and the owner's phone on the right.

[![Gatehouse demo video cover: 25% in the draft does not match 20% in the contract](https://www.imranjan.cn/images/projects/gatehouse-2026/video-poster.png)Watch the demoOpens on YouTube](https://youtu.be/Nlk77buE9Pc)

[Source code (GitHub)](https://github.com/narmi924/gatehouse)
[Live app](https://tfgcmzyn.qwenwork.page)
[Website](https://gatehouse.geo.hashmeta.tech)

## Other pages

- [Home](https://www.imranjan.cn/index.md)
- [About me](https://www.imranjan.cn/about.md)
- [Projects](https://www.imranjan.cn/projects.md)
- [Photography](https://www.imranjan.cn/gallery.md)
- [LCIMS Cloud](https://www.imranjan.cn/projects/p-lcims.md)
- [imranjan.cn](https://www.imranjan.cn/projects/p-portfolio.md)
- [PlusOne](https://www.imranjan.cn/projects/p-plusone.md)
- [Gantry](https://www.imranjan.cn/projects/p-gantry.md)
- [BYOF Agent](https://www.imranjan.cn/projects/p-byof-agent.md)
- [Shopping Copilot by KI](https://www.imranjan.cn/projects/p-shopping-copilot.md)
- [Look2Act](https://www.imranjan.cn/projects/p-look2act.md)
- [AccessAudit - On-Chain Access Approval & Audit System](https://www.imranjan.cn/projects/p-accessaudit.md)
- [Eye Touch - Real-time Eye Tracking and Gaze Control System](https://www.imranjan.cn/projects/p-eyetouch.md)
- [China Collegiate Computer Competition—Mobile Application Innovation Contest](https://www.imranjan.cn/projects/p-yigui.md)
- [Nilufar Restaurant Expense Management System](https://www.imranjan.cn/projects/p-nilufar.md)
- [Voice-Interactive LED Light Panel](https://www.imranjan.cn/projects/p-led.md)
- ["Mengsheng Cup" Electronic Design Competition](https://www.imranjan.cn/projects/p-msb.md)
- [NUS SOC SWS 2024](https://www.imranjan.cn/projects/p-nus.md)

中文版本：https://www.imranjan.cn/zh/projects/p-gatehouse.md
