# Ticket: Controlled Pi backend for Nextcloud Talk

## Metadata
- Type: Ticket
- Status: Active
- Project: Nextcloud
- Created: 2026-05-17
- Updated: 2026-05-17
- Priority: High

## Goal

Implement option 3: a controlled Pi/assistant backend path so Deeso can chat in Nextcloud Talk and move tasks forward through this repository/workspace.

## Scope

Included:
- Pull approved Talk requests from `Assistant/pi-requests.md`.
- Import new requests into this repo's workflow inbox without storing Nextcloud secrets locally.
- Keep execution controlled by the coding-agent session/operator at first.
- Preserve auditability via state, tickets, docs, and server change logs.

Not included yet:
- Fully autonomous execution daemon.
- Destructive infrastructure changes from chat.
- Public webhooks or externally exposed agent APIs.

## Acceptance Criteria

- [x] Talk bot can queue approved `pi ...` requests to `Assistant/pi-requests.md`.
- [x] Repo has an operator-run script to fetch/list queued requests from Nextcloud.
- [ ] Repo has a documented import/process workflow for queued requests.
- [ ] Imported requests can be converted into tickets/tasks with status updates.
- [ ] A safe reply/status path back to Talk is designed.

## Plan

1. MVP pull model:
   - operator runs `scripts/nextcloud_pi_request_queue.py`
   - script SSHes to Nextcloud VM and uses existing remote config/env
   - no secrets are copied into this repo
   - new requests can be imported into `inbox/capture.md`
2. Process imported items manually into tickets/tasks.
3. Add status/reply mechanism back to Talk.
4. Only after MVP is proven, consider a daemon/service or direct backend API.

## 2026-05-17 Spec Advancement

Confidence level: high for controlled pull/import design; medium for status replies; low for daemonization/autonomy.

Decisions now stable:
- The first backend should be pull-based and operator-run, not an always-on autonomous executor.
- Nextcloud secrets stay on the Nextcloud VM; the repo script uses SSH and remote config/env.
- Imported requests should enter the same ticket/spec/inbox workflow as other work.

Refined next milestone:
- Prove the end-to-end request lifecycle with one real Talk request.

Updated next actions:
- [ ] Run a real Talk `pi ...` request and approve it.
- [ ] Import with `scripts/nextcloud_pi_request_queue.py --import`.
- [ ] Decide whether imported requests go first to `inbox/capture.md`, `tasks/now.md`, or ticket creation based on size/risk.
- [ ] Add a simple status update mechanism back to Talk after import.

## Notes

- Chosen by user as “STEP 3” from the options: a controlled Pi agent service/path.
- Current implementation is deliberately a controlled pull, not autonomous execution.
