Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 31 additions & 25 deletions .cursor/rules/project.mdc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: ranch identity, Plane RANCH, solidtime, and GitHub PR conventions
description: ranch identity, Plane RANCH, time through Shadow, and GitHub PR conventions
alwaysApply: true
---

Expand Down Expand Up @@ -40,17 +40,20 @@ Labels: `admin` (`5a7513a0-d82e-486a-9d91-f64a4ca69e26`), `app` (`bca8bd04-c7ad-

## Time

- System: solidtime, self-hosted at `https://time.dreamvention.com`.
- Organization: `Dreamvention` (id `56b70c8c-e381-43da-a80a-6f8e045271dd`).
- An entry runs while you work on a task and at no other time. Start it when the task goes to In Progress; stop it when the work stops (PR open and only waiting, blocked on an answer, end of the session); start a new one when you come back.
- Description: `RANCH-<n> · <task title>`. The task id is what ties the hours to the task.
- For now solidtime has no project for ranch, so an entry carries no project: `project_id` and `task_id` are `null`. Never file ranch time under another project (Mazda USA, Mobiflor) to give it a home.
- Once a ranch project exists there (`GET $O/projects`), the entry goes under it, on a solidtime task named like the description. Nothing creates that task for you: look for it in the project, create it if it is missing, and set both `project_id` and `task_id` on the entry.
- One running entry per person. Check for a running one first and stop it before starting another.
- System: Time, which is solidtime, self-hosted at `https://time.dreamvention.com`, organization `Dreamvention`. Agents write to it through Shadow only: the `shadow` MCP server (`https://shadow.dreamvention.com/mcp`), tools `time_log`, `time_update`, `time_entries`. No direct solidtime calls: entries written around Shadow are what its widget on a Plane task could not place.
- Shadow has no tool that starts or switches a timer, and the owner does not need a live one. Hours are logged as finished intervals.
- Note the local time (`date +%H:%M`) when the task goes to In Progress. Log the interval when the work stops (PR open and only waiting, blocked on an answer, end of the session) and at natural checkpoints on long work; note a new start when you come back.
- A running timer is never yours. It belongs to the person at the widget or to nobody you know: do not start one, do not stop one, do not "switch" one. `time_log` leaves a running timer alone, and Time accepts intervals that overlap, so several agents on one account each log their own and nothing is lost.
- Change only entries you created in this session, by the `entry.id` that `time_log` returned. Never `time_delete`.
- Do not pass `billable`. Without a project an entry is not billable; under a project it takes that project's setting. Whether ranch hours are billed has not been decided.
- Never put ranch hours under another project (Mazda USA, Mobiflor) to give them a home, and never pick one from the `candidates` of a refusal.
- If the `shadow` tools are missing from your session, do not fall back to solidtime: put the intervals (task id, date, start–end) in your report so they can be logged.

Only the owner can do, and has not yet done: create the Time project for ranch (Shadow refuses an employee: "only a manager or an admin") and make a Shadow project name the key `RANCH` with that Time project. Until both exist, `time_log` with `jiraKey: "RANCH-<n>"` alone answers `logged: false`, and ranch hours go without a project, as below.

## Secrets

API keys live in **`.env.project`** (gitignored). Typical keys: `TASKS_API_KEY` (Plane), `TIME_API_KEY` (solidtime), `GITHUB_TOKEN`, plus others this repo needs. Read the file when calling Plane/solidtime/GitHub. Never print values, never commit the file, never paste keys into rules or chat.
API keys live in **`.env.project`** (gitignored). Typical keys: `TASKS_API_KEY` (Plane), `TIME_API_KEY` (solidtime, which only the timesheet skill reads), `GITHUB_TOKEN`, plus others this repo needs. Read the file when calling Plane/GitHub. Shadow needs no key from this file: its MCP server is set up per person, and its key is never printed or committed. Never print values, never commit the file, never paste keys into rules or chat.

The values live in Infisical; `.env.project` is a copy of them. `bun run env:pull` rewrites it (run it at the start of a task), logging in with the read-only machine identity in **`.env.infisical`** — gitignored, one per repo, copied into worktrees next to `.env.project`. It holds `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID`, `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET`, `INFISICAL_PROJECT_ID`, `INFISICAL_ENV` (the environment's slug, `dev`) and `INFISICAL_DOMAIN` (`https://eu.infisical.com`), and needs the `infisical` CLI. Do not edit `.env.project` by hand: add or rotate the key in Infisical and pull. A key Infisical does not have is kept and named by the pull, never dropped.

Expand All @@ -62,12 +65,12 @@ If the user describes work and does **not** give a `RANCH-<n>` id, that descript
2. Mark surface: title prefix `[ADMIN]` / `[APP]` / `[ADMIN][APP]`, plus Plane labels `admin` / `app`. Infer from `admin/` vs `app/`; if unclear, ask. API-only → `[API]`, no label. Repo tooling and docs that change no surface carry no prefix.
3. Assign to the owner of `TASKS_API_KEY`: `GET /api/v1/users/me/` returns the `id` that goes into `assignees`. If that fails, say so in the reply.
4. Reply with the task id and URL.
5. Move it to In Progress and start the time entry.
5. Move it to In Progress and note the time you started.
6. Then the usual flow: branch → work → comments → PR.

## Calls

Both services answer JSON. A body with anything outside ASCII (the `·` of a time entry, Cyrillic in a title) goes from a file — `--data @body.json` — not from the command line: a Windows shell re-encodes it and the server sees no fields at all.
Plane answers JSON. A body with anything outside ASCII (Cyrillic in a title, a `·`) goes from a file — `--data @body.json` — not from the command line: a Windows shell re-encodes it and the server sees no fields at all.

### Plane

Expand All @@ -85,22 +88,24 @@ Base `https://tasks.dreamvention.com/api/v1`, header `X-API-Key: $TASKS_API_KEY`

A `403` on a project means the key's owner is not a member of it: say so, do not look for another project.

### solidtime
### Time, through Shadow

Base `https://time.dreamvention.com/api/v1`, headers `Authorization: Bearer $TIME_API_KEY` and `Accept: application/json`. Below, `$O` is `/organizations/56b70c8c-e381-43da-a80a-6f8e045271dd`. Times are UTC, `2026-11-30T20:54:48Z`.
Tools of the `shadow` MCP server (in Claude Code `mcp__shadow__time_log` and so on). Times are `HH:MM` in local (company) time, to the minute; `date` is `YYYY-MM-DD`. An interval that crosses midnight is logged as two, one per date. Shadow does not check the clock: an `end` later than now is saved as given.

| What | Call |
|---|---|
| Your member id | `GET /users/me/memberships` → `data[0].id` |
| Is one running | `GET /users/me/time-entries/active` → the entry, or `404` when there is none |
| Start | `POST $O/time-entries` with `{"member_id": "<member id>", "start": "<now>", "end": null, "billable": false, "description": "RANCH-<n> · <title>", "project_id": null, "task_id": null, "tags": []}` → `data.id` |
| Stop | `PUT $O/time-entries/<entry id>` with `{"end": "<now>"}` |
| Projects | `GET $O/projects` → `data[].id`, `name` |
| Tasks of a project | `GET $O/tasks?project_id=<project id>&done=all` → `data[].id`, `name`, `is_done` |
| Create a task | `POST $O/tasks` with `{"name": "RANCH-<n> · <title>", "project_id": "<project id>"}` → `data.id` |
| Put an entry on a task | `PUT $O/time-entries/<entry id>` with `{"project_id": "<project id>", "task_id": "<task id>"}` |
| Log an interval on a RANCH task | `time_log` `{"date": "2026-12-01", "start": "01:08", "end": "01:42", "noProject": true, "description": "RANCH-<n> · <task title>"}` → `logged: true`, `entry.id`; project and task empty, not billable |
| A missed interval, found later | the same call with the day and the times it really happened; `{"hours": 1.5}` in place of `start` / `end` only when the times are not known |
| Correct an entry you logged | `time_update` `{"id": "<entry.id>", "end": "01:40"}`, or `start`, `date`, `description`: only what is passed changes |
| What is logged | `time_entries` `{"period": "today"}` → entries with `id`, `start`, `end` (`null` = a running timer, not yours), `project`, `task`, `description` |

- `description` is required here in practice. `time_log` with `jiraKey`, `noProject: true` and no `description` answers `logged: true` and saves an entry with an empty description: the id is only in the confirmation line, and nothing in Time says which task the hours were for. The widget and the timesheet skill both find a task by the `RANCH-<n> ·` at the start of the description.
- `logged: false` means nothing was saved, whatever else the answer says. Logged is `logged: true` with an `entry.id`.
- Without a Time project there is no Time task, so `time_report` by task shows these hours as "без задачи". That is expected until the project exists.

**A task in another Plane project.** Ranch work mostly sits in `RANCH`; work for the Mazda fork can sit in `MZDAI` (Mazda USA), and the id on the task is the one to use. For such a task call `time_log` `{"jiraKey": "MZDAI-<n>", "jiraSummary": "<task title>", "date": …, "start": …, "end": …, "description": "<what was done>"}` and no `noProject`: by the tool's description Shadow finds the Time project through the Shadow project that names the key and finds or creates the Time task `MZDAI-<n> · <title>`. This has not been run here, because Mazda USA is billable. If it answers `logged: false`, nothing was saved: report the answer and ask. Do not pass `project` from its candidates and do not use `noProject` for a client's task.

A solidtime task cannot exist without a project: `name` and `project_id` are both required, and a name is unique within its project (up to 255 characters). That is why there is no task while there is no ranch project. The create call is written from solidtime's request rules and its answer to an empty body; it has not been run to the end here. Its code refuses an employee with a `403` unless the organization lets employees manage tasks (`employees_can_manage_tasks`, off when this was written) and the project is visible to them. On that `403`, set `project_id` alone, leave `task_id` `null`, and say so in the reply.
**When Time has a ranch project** (`time_projects` lists it): try `jiraKey: "RANCH-<n>"` with `jiraSummary` and without `noProject` first. If that logs, the entry sits on the project and on the task `RANCH-<n> · <title>`, and this section should be rewritten around it; if it answers `logged: false`, the Shadow side of the mapping is still missing: log without a project as above and say so.

## OpenAPI

Expand All @@ -113,11 +118,11 @@ If generated SDK/types are missing or the backend spec looks absent: regenerate
## Status flow

1. Create a Plane work item in RANCH if none exists. Do not use Jira or Linear.
2. Move it to In Progress when starting, and start the time entry.
2. Move it to In Progress when starting, and note the time you started.
3. Branch from up-to-date `origin/main`. Never commit on `main`.
4. Task comments in a few sentences (teammate tone). Small task: start + end of implementation. Large task (several steps / slices): a checkpoint after each chunk — what landed, what's next.
5. Open a GitHub PR into `main`, put `RANCH-<n>` in the title/description, link the PR on the task.
6. Stop the time entry when the work stops.
6. Log the interval through Shadow when the work stops.
7. Move the task to Done once the PR is merged and the change has shipped, and say in a comment what shipped it.

## Plugins
Expand All @@ -133,4 +138,5 @@ Optional. Never a substitute for the tracker cycle.
- Push work on `main`
- Rewrite `user.name` / `user.email` in this clone
- Skip the tracker because the change looks small
- Leave a time entry running after the work has stopped
- Start, stop or edit a running timer, or write to solidtime around Shadow
- Finish a session with worked time that is not logged
10 changes: 5 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ At the start of every task, read `.cursor/rules/project.mdc` (project card), run

- Tracker: Plane at `https://tasks.dreamvention.com`, workspace `dreamvention`, project `RANCH` ([work items](https://tasks.dreamvention.com/dreamvention/projects/1bb00764-cb1b-4293-a28c-3a9c2fd4b8f8/issues/))
- Task: `https://tasks.dreamvention.com/dreamvention/browse/RANCH-123/`
- Time: solidtime at `https://time.dreamvention.com`, organization `Dreamvention`
- Time: solidtime at `https://time.dreamvention.com`, organization `Dreamvention`, written through Shadow (`time_log` on the `shadow` MCP server), never by calling solidtime
- Team: `RANCH` — branch `{type}/RANCH-<n>-short-slug` (`feat`, `fix`, `chore`, …), PR into `main`
- `CLEAN-<n>` in older commits, specs and comments is the Jira project this one replaced. Those ids stay as history; nothing new is filed there.
- Git author: keep this clone's existing `user.name` / `user.email`. Do not overwrite them.
- Keys: `TASKS_API_KEY` (Plane), `TIME_API_KEY` (solidtime), `GITHUB_TOKEN`, and any other tokens in `.env.project` only
- Keys: `TASKS_API_KEY` (Plane), `TIME_API_KEY` (solidtime, read by the timesheet skill only), `GITHUB_TOKEN`, and any other tokens in `.env.project` only
- Source of the keys: Infisical. `.env.project` is a copy that `bun run env:pull` rewrites, using the read-only login in `.env.infisical` (gitignored, one per repo). Do not edit `.env.project` by hand: a key that is missing or answers 401 is fixed in Infisical and pulled again. If the pull fails, say so and work from the file as it is.

**No `RANCH-<n>` in the request:** the user's description *is* the ticket. Create the Plane work item first (keys in `.env.project`), mark `[ADMIN]` / `[APP]` in the title and labels, **assign it to the owner of `TASKS_API_KEY`** (`GET /api/v1/users/me/` gives the id, which goes into `assignees`). If that fails, say so — do not leave the task unassigned silently. Send back the id/URL, move to In Progress, start the time entry — then branch/code. Do not start SpecKit or implementation without that id.
**No `RANCH-<n>` in the request:** the user's description *is* the ticket. Create the Plane work item first (keys in `.env.project`), mark `[ADMIN]` / `[APP]` in the title and labels, **assign it to the owner of `TASKS_API_KEY`** (`GET /api/v1/users/me/` gives the id, which goes into `assignees`). If that fails, say so — do not leave the task unassigned silently. Send back the id/URL, move to In Progress, note the local time you started — then branch/code. Do not start SpecKit or implementation without that id.

**Time:** a solidtime entry runs while you work on a task and at no other time. Start it when the task goes to In Progress, with `RANCH-<n> · <title>` as the description; stop it when the work stops — the PR is open and you are only waiting, you are blocked on an answer, or the session ends — and start a new one when you come back. One running entry per person: stop the one that is running before starting another. Until solidtime has a ranch project the entry carries no project, and it never goes under another one (Mazda USA, Mobiflor); once that project exists, you find or create the solidtime task `RANCH-<n> · <title>` in it yourself and put the entry on it. The calls for both services are in the project card.
**Time:** hours go into Time (solidtime) through Shadow, as finished intervals: note the local time when the task goes to In Progress, and each time the work stops — the PR is open and you are only waiting, you are blocked on an answer, the session ends, or a natural checkpoint on long work — call `time_log` on the `shadow` MCP server with `date`, `start`, `end` (`HH:MM`, local), `noProject: true` and `description: "RANCH-<n> · <title>"`. The description is the only thing that ties the hours to the task: `jiraKey` with `noProject` and no description saves an entry with an empty one. Never start, stop or edit a running timer, and never call solidtime directly: a running timer belongs to the person at the Shadow widget, and other agents log on the same account. Trust only `logged: true` with an `entry.id`; `logged: false` saved nothing. Do not pass `billable`, and never put ranch hours under another project (Mazda USA, Mobiflor). The other cases — a missed interval, a task in another Plane project, the day Time gets a ranch project — are in the project card.

**OpenAPI:** if SDK/types or `api/swagger-spec.json` are missing, regenerate first (`cd api && bun run generate:swagger` or `bun run build`, then `cd admin && bun run build:api` / `cd app && bun run build:api`). Ask where the schema is only after that fails.

Flow: Plane task → In Progress + time entry → branch from `origin/main` → work + comments on the task (small: start+end; large: checkpoints) → commit with `RANCH-<n>` → GitHub PR into `main` → link PR on the task → stop the time entry → Done once it has shipped.
Flow: Plane task → In Progress + start time noted → branch from `origin/main` → work + comments on the task (small: start+end; large: checkpoints) → commit with `RANCH-<n>` → GitHub PR into `main` → link PR on the task → log the interval through Shadow → Done once it has shipped.

Do not commit, push, or open a PR without a `RANCH-` id. Do not use Jira or Linear in this repo.

Expand Down
Loading