Skip to content

Commit 6e3f5aa

Browse files
committed
[P4] [SYNC/AROS] [2026-05-14] sync local with AROS ecosystem
1 parent 1e5b653 commit 6e3f5aa

2 files changed

Lines changed: 67 additions & 46 deletions

File tree

Grant_Write_Pipeline/Workflows/grant-write.md

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,74 +7,85 @@ description: Universal scientific grant writing pipeline — orchestrates funder
77
This workflow triggers the **Universal Scientific Grant Writing Pipeline**, transitioning the agent into a funder-agnostic proposal generator.
88

99
## Trigger Condition
10-
When the user explicitly calls `/grant-write` or implicitly asks to draft a grant, write a proposal, or generate funder documentation.
10+
When the user explicitly calls `/grant-write` or implicitly asks to draft, write, **regenerate, or edit** a grant, proposal, or funder documentation.
1111

1212
## Required AROS Context
1313
Before execution, ensure the following context is loaded via `find_helpful_ki` and `find_helpful_skills`:
1414
- **KIs**: `grant_funder_profiles`, `agentic_manuscript_publishing`, `markdown_first_manuscript_policy`, `agentic_diagramming_standard`
1515
- **Policies**: `output-truncation-management`, `gepa_protocol`
16-
- **Skills**: `grant-funding-scout`, `scientific-brainstorming`, `knowledge-consolidation`, `grant-budget-justification`, `academic-cv-generator`, `visualize-data`, `grant-mock-reviewer`, `content-proofreading`, `semantic-consistency-auditor`, `response-relevance`, `abstract-trimmer`, `medical-translation`, `q-and-a-prep-partner`, `secure-html-delivery`, `pdf-extract-experimental-materials`, `research-proposal-generator`, `word-read-write`, `comprehensive-task-completion`, `literature-close-read`, `literature-ingestion`, `retraction-watcher`, `md-html-docx-generator`.
16+
- **Skills**: `grant-funding-scout`, `scientific-brainstorming`, `knowledge-consolidation`, `grant-budget-justification`, `academic-cv-generator`, `visualize-data`, `grant-mock-reviewer`, `content-proofreading`, `semantic-consistency-auditor`, `response-relevance`, `abstract-trimmer`, `content-expander`, `medical-translation`, `q-and-a-prep-partner`, `secure-html-delivery`, `pdf-extract-experimental-materials`, `research-proposal-generator`, `word-read-write`, `comprehensive-task-completion`, `literature-close-read`, `literature-ingestion`, `retraction-watcher`, `md-html-docx-generator`.
1717

1818
---
1919

20-
## Phase 0.5: Reference Inventory & Retrieval (MANDATORY — runs before any drafting)
20+
## Phase 0: Scoping, Validation & Plan Generation (MANDATORY)
21+
> **Actor Persona:** `project_manager`
22+
> **Goal:** Decompose the user request into a concrete execution plan. **DO NOT proceed to drafting until this plan is confirmed by the user.**
23+
24+
1. **Intent Analysis**: Determine the core intent:
25+
- **`CREATE_NEW`**: A new grant from scratch.
26+
- **`REGENERATE`**: Overwriting/updating existing draft files.
27+
- **`EDIT`**: Modifying specific sections of existing drafts.
28+
2. **Constraint Identification**: Parse the user's prompt for all explicit constraints (e.g., target filenames, section length requirements like "occupy 85% of character limits", number of review rounds, specific funder guidelines).
29+
3. **Initial State Check**: If the intent is `REGENERATE` or `EDIT`, verify that the specified target files exist within the project. If not, ask the user for the correct path or confirm a switch to `CREATE_NEW` mode.
30+
4. **Plan Generation**: Create a step-by-step execution plan in Markdown. The plan must list each phase, the actions to be taken, the target files, and the identified constraints.
31+
5. **Confirmation Gate**: Present the plan to the user. Halt execution until the user explicitly approves the plan (e.g., with "Approved", "Proceed", "Yes").
32+
33+
## Phase 0.5: Reference Inventory & Retrieval (MANDATORY)
34+
> **Actor Persona:** `research_assistant`
2135
> **This phase is non-negotiable. Drafting MUST NOT begin until all cited references are available locally.**
2236
23-
1. **Inventory**: Scan `<PROJECT_ROOT>/.wiki/` and `00.RawData/Literature/03_Parsed_Markdown/` to identify all currently ingested papers.
24-
2. **Gap Detection**: Cross-reference the project's bibliography (e.g., `References/` folder, `.wiki/entities/`, or a user-provided DOI list) against ingested papers. Identify any DOIs/PMIDs that are referenced but NOT yet downloaded.
25-
3. **Auto-Retrieval**: If gaps are found, trigger `/literature-ingest` with the missing identifiers and wait for completion before proceeding. (Ensure you pass `--base-dir <PROJECT_ROOT>` to route artifacts locally per the Universal PDF Processing Mandate).
26-
4. **Retraction Scan**: Run `retraction-watcher` on the full reference list. Any retracted citation triggers a **mandatory HALT** — inform the PI and require a replacement citation before continuing.
27-
5. **Verification Gate**: Confirm that ALL key cited papers exist in both `03_Parsed_Markdown/` (for LLM context) and `04_Parsed_JSON/` (for structural validation). If any remain missing after retrieval, notify the PI and proceed only with available evidence, flagging missing citations explicitly.
37+
1. **Inventory**: Scan `./.wiki/` and `00.RawData/Literature/03_Parsed_Markdown/` to identify all currently ingested papers.
38+
2. **Gap Detection**: Cross-reference the project's bibliography against ingested papers. Identify any DOIs/PMIDs that are referenced but NOT yet downloaded.
39+
3. **Auto-Retrieval**: If gaps are found, trigger `/literature-ingest` with the missing identifiers and wait for completion.
40+
4. **Retraction Scan**: Run `retraction-watcher` on the full reference list. Any retracted citation triggers a **mandatory HALT** — inform the PI and require a replacement citation before continuing.
41+
5. **Verification Gate**: Confirm that ALL key cited papers exist in both `03_Parsed_Markdown/` and `04_Parsed_JSON/`. If any remain missing, notify the PI and proceed only with available evidence, flagging missing citations explicitly.
2842

2943
## Phase 1: Intake & Funder Configuration
30-
1. **Scouting (Optional):** If the funder is unknown, use `grant-funding-scout` and `scientific-brainstorming` to identify a target agency.
31-
2. **Profile Lookup:** Search the `grant_funder_profiles` KI for an existing profile: `read_ki_document(ki_name="grant_funder_profiles", document_path="artifacts/<funder_id>.json")`.
32-
3. **Profile Generation (Fallback):** If no profile exists and the user provides a PDF/URL of the call, use the `pdf-extract-experimental-materials` skill to extract constraints and generate a new `funder_profile.json` save it to the KI artifacts directory.
44+
1. **Scouting (Optional):** If the funder is unknown, use `grant-funding-scout` and `scientific-brainstorming` to identify a target agency.
45+
2. **Profile Lookup:** Search `grant_funder_profiles` KI for an existing profile: `read_ki_document(ki_name="grant_funder_profiles", document_path="artifacts/<funder_id>.json")`.
46+
3. **Profile Generation (Fallback):** If no profile exists, use `pdf-extract-experimental-materials` on a user-provided PDF/URL to generate a new `funder_profile.json` and save it.
3347
- *Logic Gap Prevention:* If PDF extraction fails, do NOT halt. Fallback to interactive chat: ask the PI for section names, limits, and budget rules manually.
34-
4. **Knowledge Consolidation:** Run `knowledge-consolidation` to synthesize researcher ORCID/researchmap data and wiki context.
35-
5. **Confirmation:** Stop and request user confirmation of the Funder Profile and core project data.
48+
4. **Knowledge Consolidation:** Run `knowledge-consolidation` to synthesize researcher data and wiki context.
3649

3750
## Phase 2: Visual Scheme & Timeline Generation
38-
1. **Workflow Diagram**: Use `visualize-data` to generate a high-resolution SVG/PNG technical workflow diagram based on the research plan, utilizing `fireworks-tech-graph` templates (per `agentic_diagramming_standard` KI). Choose the appropriate visual style from the 7 available options (e.g., `style-4-notion-clean` for grant proposals, `style-1-flat-icon` for journal figures).
39-
2. **Gantt / Milestone Timeline**: If the funder profile requires milestones, use `visualize-data` with the Gantt chart or grant lifecycle domain templates to create a timeline visualization.
51+
1. **Workflow Diagram**: Use `visualize-data` to generate a technical workflow diagram (SVG/PNG) based on the research plan, adhering to the `agentic_diagramming_standard` KI.
52+
2. **Gantt / Milestone Timeline**: If required, use `visualize-data` with Gantt chart templates to create a timeline visualization.
4053

4154
## Phase 3: Structural Decomposition & Drafting Engine
42-
1. **Scaffold:** Parse the sections defined in `funder_profile.json.sections`. Use `research-proposal-generator` to scaffold initial evidence limits in `00.Projects/<ProjectName>/GrantDraftElements/`.
43-
2. **Drafting (Anti-Truncation):** Iteratively draft each section as a **separate LLM call**. *Strictly adhere to the `output-truncation-management` policy.*
44-
3. **Citation-Before-Claim Protocol (MANDATORY):** Before writing any evidence-based claim, run `/wiki-query` or `literature-close-read` on the relevant ingested paper. Use the scratchpad pattern:
45-
```
46-
GROUNDING CHECK:
47-
Claim: "[The proposed claim text]"
48-
Source: "[Exact quote from .wiki/ or 03_Parsed_Markdown/]"
49-
File: [path/to/source.md or [[wiki-page]]]
50-
Verdict: GROUNDED / NOT_FOUND
51-
```
52-
If `NOT_FOUND`, run `/wiki-research` or flag as `[UNGROUNDED]`. **Do NOT write the claim until it is GROUNDED.**
53-
4. **Translation:** If `funder_profile.languages` includes multiple languages (e.g., `["en", "ja"]`), write ALL English files first, then invoke `medical-translation` to generate localized equivalents.
54-
5. **Compression:** If a section has a `limit_type` (chars/words/pages), invoke `abstract-trimmer`.
55-
- *Dead-End Prevention:* Generate 2-3 compression variants. If the agent cannot compress it to fit, halt and ask the PI to choose a variant or manually edit.
55+
> **Actor Persona:** `manuscript_writer`
56+
57+
1. **Scaffold:** Parse `funder_profile.json.sections`. Use `research-proposal-generator` to scaffold initial Markdown files in `./GrantDraftElements/`.
58+
2. **Drafting (Anti-Truncation):** Iteratively draft each section as a **separate LLM call**. *Strictly adhere to the `output-truncation-management` policy.*
59+
3. **Draft, Placeholder, and Ground Protocol (MANDATORY):**
60+
a. **Draft First**: Write a full paragraph or section focusing on scientific flow and argumentation.
61+
b. **Insert Placeholders**: After drafting, review the text and insert citation placeholders for every evidence-based claim, e.g., `[CITE: mechanism of action for drug X]`.
62+
c. **Grounding Pass**: In a separate, dedicated step, use `/wiki-query` or `literature-close-read` to resolve all `[CITE: ...]` placeholders with actual references. Any claim that cannot be grounded must be flagged as `[UNGROUNDED - EVIDENCE REQUIRED]`.
63+
4. **Content Length Adjustment**:
64+
- **Expansion**: If the Phase 0 plan includes a minimum length constraint (e.g., "85% fill rate"), and a drafted section is too short, invoke the `content-expander` skill to elaborate on technical details, add context, or provide more examples.
65+
- **Compression**: If a section exceeds a `limit_type` (chars/words), invoke `abstract-trimmer`.
66+
- *Dead-End Prevention:* If automated adjustments fail to meet constraints, halt and ask the PI for guidance.
67+
5. **Translation:** If `funder_profile.languages` requires multiple languages, write ALL English files first, then invoke `medical-translation` to generate localized equivalents.
5668

5769
## Phase 4: CV, Publications & Budget Generation
58-
1. **Biosketch/CV:** If `funder_profile` requires a CV, generate it using `academic-cv-generator`.
59-
2. **Budget:** Run `grant-budget-justification` against `funder_profile.budget` constraints (caps, indirect rates, personnel limits).
70+
1. **Biosketch/CV:** If required, generate using `academic-cv-generator`.
71+
2. **Budget:** Run `grant-budget-justification` against `funder_profile.budget` constraints.
6072

6173
## Phase 5: Simulated Peer Review & Quality Gates
62-
> **Minimum 3 review rounds are MANDATORY regardless of initial score.**
74+
> **Actor Persona:** `peer_reviewer`
6375
64-
1. **Mock Review (≥3 Rounds):** Run `grant-mock-reviewer` (Actor-Critic pattern from `agentic_manuscript_publishing` KI) to assess the draft against `funder_profile.evaluation_criteria`.
65-
- Output each review round as a new `## Round N` section in `<ProjectRoot>/GrantDraftElements/REVIEW_LOG.md`.
66-
- **Grounding Audit:** The reviewer MUST flag any claim that cannot be traced to a `.wiki/` or `03_Parsed_Markdown/` source as `[UNGROUNDED — CITE REQUIRED]`.
76+
1. **Review Round Configuration**:
77+
- **Default:** Minimum of 3, maximum of 5 refinement rounds.
78+
- **User Override:** If the user specified a number of rounds in the initial prompt (and it was approved in the Phase 0 plan), that number becomes the **mandatory** target.
79+
2. **Mock Review Loop:** Run `grant-mock-reviewer` to assess the draft against `funder_profile.evaluation_criteria`.
80+
- Output each review round as a new `## Round N` section in `./GrantDraftElements/REVIEW_LOG.md`.
81+
- **Grounding Audit:** Reviewer MUST flag any claim not backed by a citation as `[UNGROUNDED — CITE REQUIRED]`.
6782
- **Retraction Audit:** Verify the final reference list with `retraction-watcher` after every revision round.
68-
- *Loop Enforcement:* Run a minimum of **3 refinement rounds**. Even if the draft passes evaluation criteria before Round 3, continue with a "hardening review" targeting citation completeness, budget accuracy, and language compliance. Maximum 5 rounds total (per `gepa_protocol`). If it still fails after Round 5, escalate to the PI.
69-
2. **Quality Gates:** Run `content-proofreading`, `semantic-consistency-auditor`, and `response-relevance` to verify grammar, cross-section coherence, and mandate compliance.
83+
- **Loop Enforcement:** Continue review/refinement cycles until the target number of rounds is complete. If the draft fails evaluation after the final round, escalate to the PI.
84+
3. **Quality Gates:** After the final review round, run `content-proofreading`, `semantic-consistency-auditor`, and `response-relevance`.
7085

7186
## Phase 6: Assembly, Finalization & Delivery
72-
1. **Assembly:** Compile sections per the `submission_format` constraint (e.g., inject into `.xlsx`, use Pandoc for PDF/LaTeX, or `word-read-write` for `.docx`). *Enforce `markdown_first_manuscript_policy`.*
73-
2. **Interactive HTML Report (Optional):** If the PI requests an interactive deliverable or a shareable progress report, run the `md-html-docx-generator` skill on the assembled Markdown:
74-
```bash
75-
python3 01.Shared_Assets/Skills/md-html-docx-generator/scripts/build_report.py \
76-
<assembled_markdown.md> -o <ProjectRoot>/output/grant_report.html [--docx]
77-
```
78-
3. **Oral Defense:** If `has_oral_defense` is true, invoke `q-and-a-prep-partner` to generate an elevator pitch and defense material.
79-
4. **Secure Delivery:** If requested by the PI, invoke `secure-html-delivery` to encrypt the HTML deliverables for external sharing via AES-256-GCM.
80-
5. **Commit:** Execute `/lab-commit` to transactionally save the state to version control.
87+
1. **Assembly:** Compile sections per the `submission_format` constraint (e.g., inject into `.xlsx`, use Pandoc for PDF/LaTeX, or `word-read-write` for `.docx`). *Enforce `markdown_first_manuscript_policy`.*
88+
2. **Interactive HTML Report (Optional):** If requested, run `md-html-docx-generator`.
89+
3. **Oral Defense:** If `has_oral_defense` is true, invoke `q-and-a-prep-partner`.
90+
4. **Secure Delivery:** If requested, invoke `secure-html-delivery` to encrypt HTML deliverables.
91+
5. **Commit:** Execute `/lab-commit` to transactionally save the state to version control.

workspace_management/Workflows/wiki-update.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ Run the following python script via the terminal. It checks the DB lock internal
133133
python3 -c "import sys; import os; sys.path.insert(0, os.path.expanduser('~/.gemini/antigravity/antigravity-evolution/src')); from antigravity_evolution.policy_evolver import propose_policy_update; from antigravity_evolution.policy_analyst import generate_performance_report; report = generate_performance_report(); propose_policy_update(report) if 'error' not in report and report.get('status') != 'insufficient_data' else print('No evolution required: ' + str(report))"
134134
```
135135

136+
## Step 4.6: Daemon Health Verification
137+
138+
Ensure that the core AROS background daemons (including the `mutation_sweeper` and `dreamer`) are executing properly without silent failures.
139+
140+
```bash
141+
# // turbo
142+
python3 -c "import os, sqlite3, time; db_path = os.environ.get('BRAIN_DB_PATH', os.path.expanduser('~/.gemini/antigravity/brain.db')); db = sqlite3.connect(db_path); failed_jobs = db.execute(\"SELECT id, agent_role, created_at, status FROM swarm_jobs WHERE status = 'failed' AND created_at > datetime('now', '-24 hours')\").fetchall(); print(f'\\n=== Daemon Health Report ===\\nFailed Jobs (Last 24h): {len(failed_jobs)}'); [print(f'- {j[1]} (ID: {j[0]}) at {j[2]}') for j in failed_jobs]; db.close()"
143+
```
144+
If this health report shows recent failures for system daemons, check the SwarmDoctor logs in `~/.gemini/antigravity/logs/` to verify auto-healing was engaged.
145+
136146
## Step 5: Auto-Commit
137147

138148
Delegate to the canonical `/lab-commit` workflow. Do NOT write inline `git add` / `git commit` commands here — the lab-commit workflow handles staging, Obsidian symlink verification, project registry updates (e.g., INDEX.csv or PIPELINE_REGISTRY.md), and commit message formatting automatically.

0 commit comments

Comments
 (0)