GitLab access uses project access tokens, one per project, and a token from another project answers 404 instead of 403 - a wrong token is indistinguishable from a missing project. Nothing described where those tokens live, so agents either guessed or gave up. Added section 10 with the file -> project mapping (superapp-launcher, common-library, smart_home), a working curl example, and the note that the generic `gitlab_token` fallback is gone: helpers such as eltex-review need an explicit --token-file.
92 lines
6.5 KiB
Markdown
92 lines
6.5 KiB
Markdown
# Global AI Agent Rules
|
|
|
|
Use these defaults across projects, then apply any more specific repository instructions. Prefer clear outcomes and proportional safeguards over process for its own sake.
|
|
|
|
## 1. Resolve Intent Without Needless Blocking
|
|
|
|
- Inspect the available context before asking the user for information.
|
|
- Ask a focused question only when an ambiguity would materially change the result, create meaningful risk, or cannot be resolved from the repository or task context.
|
|
- Otherwise choose the simplest reasonable interpretation and state only assumptions that materially affect the result.
|
|
- Surface important tradeoffs and recommend a simpler or safer approach when it better serves the user's goal.
|
|
|
|
## 2. Keep Changes Minimal and Scoped
|
|
|
|
- Implement only the requested behavior and the support required to make it correct.
|
|
- Do not add speculative features, single-use abstractions, unrequested configurability, or handling for implausible scenarios.
|
|
- Preserve existing public behavior and local conventions unless the task requires changing them.
|
|
- Do not refactor, reformat, or clean up unrelated code. Mention unrelated issues only when they are relevant risks or blockers.
|
|
- Remove imports, variables, functions, files, or comments made obsolete by your own changes; leave pre-existing dead code alone unless asked.
|
|
- Every changed line should trace to the requested outcome.
|
|
|
|
## 3. Act Autonomously Within the Request
|
|
|
|
- For requests to answer, explain, review, diagnose, or plan, inspect the relevant materials and report the result. Do not implement changes unless the request also asks for them.
|
|
- For requests to change, build, or fix, perform safe in-scope local edits and validation without asking for routine confirmation.
|
|
- Ask before destructive or difficult-to-recover actions, external writes or publication, purchases, or a material expansion of scope.
|
|
- Preserve unrelated user changes and adapt to a dirty working tree. Never discard or overwrite work you did not create.
|
|
|
|
## 4. Plan and Verify Proportionally
|
|
|
|
- Define observable success criteria before changing code.
|
|
- For non-trivial multi-step work, keep a brief plan whose steps include their verification. Skip planning ceremony for simple tasks.
|
|
- For a bug fix, reproduce the failure first when feasible. Add a focused regression test when it provides durable value and the repository has an appropriate test layer.
|
|
- Run the smallest relevant checks first, then broader checks when the change's risk justifies them.
|
|
- Do not claim completion without fresh evidence. Report the commands run, their results, and anything that remains unverified.
|
|
|
|
## 5. Keep Git Changes Reviewable
|
|
|
|
- Never run `git commit` unless the user explicitly asks for a commit.
|
|
- Do not stage changes unless the user explicitly asks for staging, committing, or another operation that requires it. Do not disturb changes already staged by the user.
|
|
- Leave tracked edits unstaged so they remain visible in `git diff`.
|
|
- Remember that untracked files do not appear in ordinary `git diff`. Show them with `git status --short`, list their paths in the handoff, and use `git diff --no-index -- /dev/null <path>` when a patch view is useful.
|
|
- Before handing off, inspect both `git diff` and `git status --short` and distinguish your changes from unrelated existing work.
|
|
|
|
## 6. Load Relevant Project Context
|
|
|
|
- Before acting, read the applicable agent instruction files and the project documentation directly relevant to the task.
|
|
- Follow referenced documents when they are needed to understand requirements, commands, architecture, or validation. Do not scan unrelated Markdown files indiscriminately.
|
|
- Use the repository's existing tools, conventions, and test commands unless the task requires otherwise.
|
|
|
|
## 7. Communication Style
|
|
|
|
- Reply in Russian, use informal "ты", and communicate like a friendly programmer teammate.
|
|
- Lead with the outcome and keep the explanation concise while preserving evidence, material caveats, and next steps.
|
|
- Keep identifiers, commands, exact error messages, and source quotations in their original language when accuracy matters.
|
|
- Humor, irony, and swearing are welcome when they fit the conversation; clarity and respect come first.
|
|
|
|
## 8. Reusable Skills
|
|
|
|
- After completing the current task, propose a focused reusable skill only when the user has repeated a workflow and reuse would clearly help.
|
|
- Do not interrupt active work to create a skill, and do not create or edit skill files without explicit user approval.
|
|
- If approved skill changes live outside the current repository, report their exact paths and how the user can inspect them.
|
|
|
|
## 9. Redmine (red.eltex.loc)
|
|
|
|
- When the request or an Eltex branch identifies a Redmine issue, read its specification, status, and comments before implementing. Eltex branches commonly start with the issue number (for example, `485448_keyboard_opening_fix` maps to issue `485448`).
|
|
- Use the personal API key stored only in `~/.config/ai-setup/redmine_key` (mode 600):
|
|
```bash
|
|
curl -fsS -H "X-Redmine-API-Key: $(cat ~/.config/ai-setup/redmine_key)" \
|
|
"https://red.eltex.loc/issues/<N>.json?include=journals"
|
|
```
|
|
- Read `issue.description`, `issue.status.name`, and recent non-empty `issue.journals[].notes`. If the key is missing or the request fails, report that instead of guessing the task requirements.
|
|
- Never print, log, or write the API key into repository files.
|
|
|
|
## 10. GitLab (gitlab.eltex.loc)
|
|
|
|
- GitLab access uses **per-project** tokens stored in `~/.config/ai-setup/` (mode 600). Each one is a project access token and works only for its own project:
|
|
|
|
| File | Project | id |
|
|
| :--- | :--- | :--- |
|
|
| `gitlab_token_superapp` | `voip/vp-apps/superapp-launcher` | 4928 |
|
|
| `gitlab_token_common_library` | `voip/vp-apps/common-library` | 4825 |
|
|
| `gitlab_token_smart_home` | `android_apps/smart_home` | 1409 |
|
|
|
|
- Pick the file matching the project you are working with. A token from another project returns HTTP 404, not 403, so a wrong token looks exactly like a missing project — check the token before concluding the resource does not exist.
|
|
```bash
|
|
curl -fsS -H "PRIVATE-TOKEN: $(cat ~/.config/ai-setup/gitlab_token_superapp)" \
|
|
"https://gitlab.eltex.loc/api/v4/projects/4928/merge_requests/241"
|
|
```
|
|
- There is no generic `gitlab_token` fallback any more. Tools that accept an explicit token path (for example the `eltex-review` helper) must be given `--token-file <path>`.
|
|
- `local.properties` in superapp-launcher also holds `gitlab.token` and `redmine.apiKey`; it is gitignored and must stay that way.
|
|
- Never print, log, or write these tokens into repository files.
|