Initial MCP server commit

This commit is contained in:
2026-04-12 22:15:46 +03:00
commit 362fde4d1b
86 changed files with 83311 additions and 0 deletions

233
AGENT.interaction.md Normal file
View File

@@ -0,0 +1,233 @@
# AGENT.interaction
## ACTIVATION
SCOPE: any agent-initiated user-facing output requiring a choice, approval, confirmation, clarification, branch selection, or action selection.
TRIGGER: automatic — no explicit activation required.
SCOPE EXCLUSIONS: internal tool calls, system/developer-level constraints.
OVERRIDE: these rules override normal conversational behavior within scope. Safety and ethics constraints take absolute precedence.
---
## OUTPUT CONTRACT
### Format
```
<INSTRUCTION>
1) <OPTION>
2) <OPTION>
3) <OPTION>
```
### Constraints
- First character of response = first character of instruction text
- Instruction: single sentence, ≤ 15 words
- Options: ≤ 7 per question, ≤ 5 words each
- Blank line between instruction and options
- No text before instruction
- No text after last option
- No labels: "Answer:", "Choose:", "Single choice"
- No explanations, comments, status messages, summaries
- No soft offers (see SOFT OFFERS)
- No "Other" option (see OPTIONS AUTHORITY)
### Valid input
```
1 → single select
1,3 → multi-select (comma-separated, no spaces)
abort → emit FLOW_CANCEL
cancel → emit FLOW_CANCEL
<freetext> → pass to system as-is; do not interpret
```
### Invalid input — reject and repeat
```
"option 2"
"I choose 1"
"probably 3"
"1, 3" (spaces in multi-select)
"" (empty)
```
---
## FLOW
### State machine
```
step_1 → step_2 → ... → CONFIRMATION
↑_________ RESTART ________|
```
- One question per step
- Do not proceed until current step receives valid input
- Do not skip steps
- Do not track state — state is injected by system per request
- Do not reorder steps
### Step completion
Step is complete when: input is valid AND value is parsed.
Otherwise: stay on same step.
### Confirmation (mandatory final step)
```
Summary:
- <field>: <value>
- <field>: <value>
1) Confirm
2) Restart
3) Edit specific step
```
### Compact mode
Input format: `key=N key=N ...`
- N must be an exact option number
- Valid fields: apply, skip their steps
- Invalid N for a field: reject that field, ask its step normally
- All fields valid: skip to CONFIRMATION
---
## EXECUTION SILENCE
After receiving valid input, the model MUST execute silently.
PROHIBITED after valid input:
- announcing the plan before acting ("Перехожу на ветку X, затем...")
- narrating steps in progress
- summarizing what was done in free text
- any output between receiving input and the next question block or result
The next user-visible output after valid input MUST be either:
- the result of the action (tool output, file content, etc.), OR
- the next question block in the flow
PROHIBITED pattern:
```
✗ "Перехожу на релизную ветку feat/release-v0.2.9, затем подготовлю версию 0.2.9..."
```
REQUIRED pattern:
```
[executes silently]
→ next question block or action result
```
---
## VALIDATION
### Strictness
- Exact match only
- No partial matches
- No intent interpretation
- No auto-correction
- No implicit defaults
### Retry sequence
```
attempt 1: show error + repeat question
attempt 2: show error + emphasize format (1 / 2 / 1,3)
attempt 3: minimal hint
attempt 4: emit STEP_ABORT
```
Never relax rules across retries.
---
## ABORT & ESCALATION
| Condition | Emit |
|---|---|
| 4+ consecutive invalid inputs | `STEP_ABORT` |
| input = `abort` or `cancel` | `FLOW_CANCEL` |
On abort: emit event code only. No additional text.
---
## SOFT OFFERS
PROHIBITED. Any phrase offering an action without presenting a choice block is a format violation.
```
✗ "Если хочешь, могу выполнить коммит"
✗ "Let me know if you want to proceed"
✗ "Могу сделать push — скажи, если нужно"
```
When an action is available — even one — present a choice block:
```
Выполнить коммит и push?
1) Да
2) Нет
```
---
## OPTIONS AUTHORITY
- Option list MUST be exhaustive
- "Other" is PROHIBITED
- Free-text is always available to the user implicitly — never offer it as an option
- An incomplete option list is a design error; resolve by expanding options or splitting into sub-steps
---
## OUTPUT PURITY
PROHIBITED in any response within scope:
- Reasoning
- Planning
- Analysis
- Status updates
- Progress logs
- Action explanations
Internal reasoning MUST NOT appear in output.
---
## DETERMINISM
- Same input → same output
- Option order: fixed, never shuffled
- Option text: never rephrased between retries or sessions
---
## VIOLATION HANDLING
Non-compliant output: system discards and regenerates.
Model is not notified of regeneration.
---
## PRIORITY
```
1. Safety & ethics — absolute, cannot be overridden
2. Determinism
3. Structure
4. Format compliance
5. User convenience
```