<!--
  Parsec Sdn. Bhd. · AMIR
  Generated by the Parsec Sdn. Bhd. AI Development Framework v2
  © 2026 Parsec Sdn. Bhd. All rights reserved.
  Internal use only. Unauthorised use outside Parsec Sdn. Bhd.-authorised projects is prohibited.
-->

# PROJECT CONTEXT — AMIR

**Product:** AMIR — AI-native SME accounting SaaS with pluggable vertical packs, Malaysia-first
**Vertical Pack #1:** Koperasi (cooperative societies regulated by SKM under Akta Koperasi 1993)
**Prepared by:** Parsec Sdn. Bhd.
**Phase:** 2 (Product Definition)
**Document Version:** 1.1 (roles vs personas separation per B22; fork semantics per B10-R1)
**Last Updated:** 23 April 2026

---

## 1. Product Vision

AMIR is a cloud-based, AI-native accounting platform built for Malaysian SMEs, with a vertical-pack architecture that lets the same codebase serve general SMEs and specific regulated industries without re-implementation.

The first vertical pack targets **cooperative societies (koperasi)** — a 16,342-strong sector regulated by SKM (Suruhanjaya Koperasi Malaysia) under Akta Koperasi 1993, with assets of RM 268 billion and growing compliance requirements via GP23 reporting standards.

AMIR differs from the Malaysian SME accounting incumbents (SQL Account, AutoCount, Bukku, QNE) on four structural dimensions:

1. **AI-native from day one.** A Signal engine produces forecasts, anomalies, compliance nudges, financial health scoring, pattern insights, and member-level alerts — with natural-language explanations. No incumbent ships meaningful AI today.
2. **Regulator-as-platform-admin architecture.** SKM (and future regulators) operate as a first-class platform admin with aggregated views across their jurisdiction, not as a data-sharing guest. Enables B2B2C delivery.
3. **Vertical pack architecture.** Koperasi-specific logic (GP23, Statutory Reserve Fund, Ar-Rahnu, member register, SKM zones) is a pluggable pack, not a monolith modification. SME Pack (v2), Property Pack, F&B Pack can follow.
4. **Offline-capable PWA.** Works on unstable connections common outside urban Malaysia. No Malaysian SME accounting SaaS offers this today.

---

## 2. The Problem

### 2.1 What the problem actually is

Malaysian cooperatives are legally required to maintain accounting records, prepare financial statements within 2 months of financial year-end, and submit audited reports to SKM — all per Akta Koperasi 1993 §§57-59 and GP23 (the SKM reporting guideline, Pindaan 2020 updated 2023). These are not optional obligations; non-compliance attracts regulatory penalties and SKM enforcement actions.

The reality on the ground:
- **Most koperasi use Excel** — specifically, SKM's 114-sheet "Easy Coop" spreadsheet template, which SKM built precisely because koperasi couldn't afford commercial accounting software. It's free, it's GP23-aligned, and it's what ~15,000 small/micro koperasi actually use.
- **ANGKASA SPBA** (free to ANGKASA member koperasi) serves larger members but is a desktop-era product without cloud, AI, or regulator integration.
- **Commercial SaaS (AutoCount, SQL Account)** is too expensive (RM 1,500-3,000 lifetime or RM 100+/month) and designed for general SMEs — they don't know GP23, don't understand the Statutory Reserve Fund, don't model Ar-Rahnu, don't report to SKM.
- **Excel is breaking.** 114-sheet workbooks corrupt, drift between versions, can't be audited from two places simultaneously, can't produce real-time signals about financial health, and crucially — **cannot integrate with SKM's internal systems** (Infokop, SPKB, SPMKK, SAK). SKM is modernising; the Excel tool isn't.

### 2.2 Why now

Three timing pressures converge in 2026:

1. **SKM has commissioned its replacement.** Tender S005/2026 is live for "Easy Coop 2.0" — a web-based successor. Submission 21 May 2026. Funded build path with SKM as first distribution channel.
2. **LHDN e-Invoice is in force.** Phase 4 (RM1M-RM5M turnover) mandatory from 1 Jan 2026; Phase 5 (below RM1M) from 1 Jul 2026. Cooperatives are explicitly in scope. Accounting software without native MyInvois integration is obsolete.
3. **PDPA 2024 changed the game.** Mandatory DPO appointment, 72-hour breach notification, data processor direct liability as of June 2025. Spreadsheet-based accounting with ad-hoc WhatsApp sharing is now non-compliant. Cloud SaaS with baked-in compliance is not optional — it's the default.

### 2.3 Who has the problem

Primary problem-holders:
- **~15,000 Small and Micro koperasi** on Excel (Easy Coop) today, struggling with monthly close, compliance deadlines, and audit preparation
- **~900 Medium koperasi** on a mix of Excel and commercial software, paying too much for tooling that doesn't understand koperasi
- **SKM itself** — which needs a modern platform to aggregate sector data, monitor compliance, and deliver on DaKoM 2030's RM 73B sector revenue target

Secondary problem-holders:
- **Cooperative auditors** (listed by SKM) whose job is harder when koperasi records are paper or scattered Excel workbooks
- **Koperasi members** who receive AGM financial statements prepared weeks after their financial year ends, with limited visibility between AGMs

---

## 3. The Solution

### 3.1 What we're building

AMIR is a web-based multi-tenant SaaS that:

- Lets koperasi tenants enter transactions through a cash-book UX familiar to Easy Coop users
- Enforces GP23-compliant chart of accounts and automatically generates GP23-conformant financial statements (Kunci Kira-Kira, Akaun Untung Rugi, Akaun Pembahagian Keuntungan, Penyata Aliran Tunai, 80+ note schedules)
- Handles Statutory Reserve Fund, Education Trust Fund, Development Trust Fund appropriations automatically per Akta Koperasi §57
- Runs an AI Signal engine that produces forecasts, flags anomalies, scores financial health against peer benchmarks, and delivers compliance nudges in natural Bahasa Malaysia
- Works offline as a Progressive Web App — transactions entered without internet sync when connectivity returns
- Integrates with LHDN e-Invoice (MyInvois) as a first-class feature, not an afterthought
- Provides SKM with a platform-admin dashboard showing aggregated data at HQ, state, and zone levels — a regulator-native view across the entire tenant base

### 3.2 Dual-product delivery

The same codebase ships as two products (Decision B10):

- **AMIR (primary, Parsec-owned commercial SaaS):** General SaaS sold to the open Malaysian SME market, starting with koperasi. Parsec's commercial product, Parsec's roadmap, Parsec's customers.
- **Easy Coop 2.0 (tender delivery, SKM-owned):** A Parsec-delivered, SKM-owned system delivered under Tender S005/2026 if won. Per Decision B10-R1, **Easy Coop 2.0 is produced by copy-and-detach from the AMIR codebase at a demo-ready checkpoint, then scrubbed and developed independently.** After delivery, SKM owns it per tender clause R34. The two codebases diverge permanently from the fork point.

**Why copy-and-detach, not shared codebase:** Tender clause R20 prohibits commercial reuse of tender IP for 3 years; tender clause R34 transfers full ownership of the delivered system to SKM. A shared codebase would make AMIR's commercial origin visible to SKM (contract breach risk) and create perpetual architectural coupling between Parsec's commercial roadmap and SKM's operational needs. Copy-and-detach is the clean legal, architectural, and business answer.

**What the fork inherits:** The full Core + Koperasi Pack at the demo-ready checkpoint. Roughly the entire v1 feature set as it exists on 21 May 2026.

**What gets scrubbed before Easy Coop 2.0's first commit:** All AMIR/Parsec branding; commercial-only modules (billing, subscription, signup flow, multi-pack marketplace); AMIR-specific environment config, README, documentation; AMIR-namespaced code paths. Replaced with SKM branding, SKM-specific integrations (Infokop, SPKB, SPMKK, SAK), PDSA JDN deployment config.

**What diverges after fork:** Everything. No sync of fixes, no shared dependencies, no cross-product architectural decisions. AMIR evolves for Parsec's commercial customers; Easy Coop 2.0 evolves for SKM's operational needs.

### 3.3 Differentiation ladder

From strongest to weakest (Decision B6):

1. **AI Signal engine** — the once-in-a-decade wedge, with a 12-24 month shelf life before incumbents close the gap
2. **B2B2C regulator architecture** — structural defensibility, hard to replicate without rebuilding
3. **Vertical pack architecture** — future verticals become products, not customisations
4. **Non-accountant UX** — cash-book-first, passes the "Kak Yati the kerani akaun" test
5. **Bahasa Malaysia first** — barrier to entry for English-first global competitors like Xero
6. **GP23 compliance automation** — what incumbents treat as manual work, AMIR treats as a feature
7. **TEHA heritage** — demonstrated B2B2C scale in Malaysia (Parsec track record)

---

## 4. Who AMIR Is For

AMIR has **three canonical roles** (Decision B22) and **four illustrative personas** (Decision B16). These are different things:

- **Roles** are the permission structure baked into AMIR Core — Spatie roles, middleware, menu gating. Roles are stable across packs and deployments. There are three.
- **Personas** are illustrative users we design and write for — real-sounding examples that shape UI copy, feature decisions, and content. There are four across AMIR's deployments.

Each role is served by one or more personas depending on whether AMIR is running as commercial SaaS or the Easy Coop 2.0 fork.

### 4.1 The three canonical roles (Decision B22)

| Canonical role | Capability scope | AMIR deployment label | Easy Coop 2.0 deployment label (post-fork) |
|---|---|---|---|
| **Platform Operator** | Multi-tenant oversight, tenant provisioning, support, integrations, PDPA ops, (AMIR only: billing) | Parsec Operator | SKM Officer / Pegawai Audit |
| **Tenant Admin** | Single-tenant oversight, approvals, period close, config, pack management, report generation | Company Owner (SME context); Setiausaha / Bendahari (Koperasi context) | Setiausaha / Bendahari |
| **Tenant User** | Day-to-day transaction entry, routine operational work | Company Accountant (SME); Kak Yati the kerani akaun (Koperasi) | Kak Yati |

All three roles exist in every AMIR deployment regardless of pack. Per Decision B22, packs extend features and menu items — not roles. Role labels are deployment-configurable; capabilities are pack-aware (e.g. Koperasi Pack enables hierarchical HQ/state/zone dashboard for the Platform Operator role).

Per Decision B23, AMIR runs as a **single Laravel app** (mirroring TEHA) with role-aware navigation. Spatie middleware gates routes; the sidebar component renders conditional menu items based on the logged-in user's role. One URL, three menu trees, conditional rendering.

### 4.2 The four illustrative personas (Decision B16)

Personas are storytelling devices used to sharpen design and content decisions. They are not roles.

#### Kak Yati — Tenant User (Koperasi context)

- Paid clerical staff, full-time employee of the koperasi
- Accounting training (debit/credit, cash book, GP23 expectations) — but software fluency is low
- Mental model: "the Easy Coop spreadsheet, but online"
- Daily work: entering receipts and payments, reconciling bank statements, preparing monthly summaries
- Pain today: Excel errors, version drift, manual GP23 note preparation, can't work when internet is unstable
- What she needs from AMIR: faster transaction entry than paper or Excel, automatic double-entry, forgiving error handling, offline mode, mobile access

**Design implication:** The Buku Tunai (cash book) screen is the most-used screen in the entire product. It must look like what Kak Yati already does on paper. Big obvious buttons. No software jargon. Progressive disclosure of complexity. This is the primary design target for Tenant User UX.

#### Setiausaha / Bendahari — Tenant Admin (Koperasi context)

- Elected board member, part-time, unpaid or honorarium-paid
- Moderate accounting knowledge (they attend AGMs, sign reports, represent members)
- Reviews what Kak Yati enters, signs off, makes larger decisions
- Pain today: visibility comes only at month-end or year-end; can't tell financial health between reports
- What they need from AMIR: dashboard showing financial health trend, approval workflow for larger transactions, compliance deadline reminders, final report generation before AGM

**Design implication:** Tenant Admin dashboard leads with health signals and deadline reminders, not raw data. Approval queues visible. Export-to-AGM-ready-PDF is a one-click action.

#### Puan Suraya — Platform Operator (Koperasi Pack enabled, post-fork to Easy Coop 2.0)

- Audit officer at SKM HQ, state office, or zone office
- High accounting literacy, moderate software fluency (used to Infokop, SPKB, SPMKK, SAK)
- Job-to-be-done: periodic compliance review across her assigned koperasi portfolio
- Needs: cross-tenant view at HQ/state/zone levels; drill into a specific koperasi's ledger; identify late/missing reports; flag for follow-up; export evidence

**Design implication:** The Koperasi Oversight section of the Platform Operator sidebar is an **audit-review tool first**, management dashboard second. Primary navigation: "koperasi needing attention" (late reports, compliance flags, anomaly signals) → "koperasi in my zone/state" → "specific koperasi deep-dive." Export functions everywhere. Search is a first-class feature.

**Note:** In AMIR (Parsec-run commercial SaaS), the Platform Operator role is staffed by Parsec Operators. In Easy Coop 2.0 (post-fork, SKM-owned), the same role is staffed by SKM officers like Puan Suraya. Same role, different deployment, different label.

#### Parsec Operator — Platform Operator (AMIR context)

- Parsec staff responsible for tenant provisioning, support, billing, system health
- High software + accounting literacy
- Daily work: onboarding new tenants, support ticket triage, integration monitoring, pack configuration
- Pain potential: without good ops tools, a solo founder can't scale past ~50 tenants

**Design implication:** The Platform Operator sidebar in AMIR is effectively a "SaaS control tower" — tenant list, provisioning wizard, support ticket queue, integration health, system metrics, billing/subscription view. Billing is hidden at scrub time when the codebase forks to Easy Coop 2.0 per B10-R1.

---

## 5. Feature Inventory (v1 Scope)

Every feature categorised by priority (framework Section 2.1) and tagged by demo-critical status (Decision B11-R1).

### 5.1 Core features

| Feature | Priority | Demo-critical | Persona(s) | Spec ref |
|---|---|---|---|---|
| Multi-tenancy with 3-tier hierarchy | P0 | Yes | All | A5 |
| Spatie auth + role-based permissions | P0 | Yes | All | A4 |
| Audit log with 6-year retention | P0 | Yes | All | A4, B4 |
| Chart of accounts engine (hierarchical, extensible by pack) | P0 | Yes | Kak Yati, Setiausaha | R70-R75 |
| Journal entry with double-entry enforcement | P0 | Yes | Kak Yati | R114-R119 |
| General ledger, AR ledger, AP ledger | P0 | Yes | Kak Yati, Setiausaha | R98-R112 |
| Trial balance | P0 | Yes | Kak Yati, Setiausaha | R152 |
| P&L (Akaun Untung Rugi) | P0 | Yes | Kak Yati, Setiausaha, Puan Suraya | R151 |
| Balance Sheet (Kunci Kira-Kira) | P0 | Yes | All | R149 |
| Cash Flow Statement (Penyata Aliran Tunai) | P0 | Yes | Setiausaha, Puan Suraya | R153 |
| Notes to Accounts template engine | P0 | Yes | Kak Yati, Setiausaha | R154, R164-R166 |
| Cash-book UX (Buku Tunai) — primary entry screen | P0 | Yes | Kak Yati | A8, R77-R97 |
| Period management (open/close/lock) | P0 | Yes | Setiausaha, Parsec | R75 |
| Fixed asset register with depreciation | P0 | Yes | Kak Yati | A9, R120-R128 |
| Bank reconciliation (manual v1) | P0 | Yes | Kak Yati | A11, R93-R97 |
| Inventory (FIFO/LIFO/WA) | P0 | Yes (FIFO live; LIFO/WA configurable) | Kak Yati | A16-R1, R129-R135 |
| Receipts generation (running number) | P0 | Yes | Kak Yati | R85 |
| Payment voucher generation (running number) | P0 | Yes | Kak Yati | R92 |
| Invoice, credit note, debit note generation | P0 | Yes | Kak Yati | R105 |
| Budget/forecast | P1 | No | Setiausaha | A10 |
| Report export (Excel, CSV, PDF) | P0 | Yes | All | R167, R172 |
| Attachments (receipts, invoices) | P0 | Yes | Kak Yati | — |
| Dashboard framework | P0 | Yes | All | R32-R36, R37-R43 |
| Multi-currency scaffolding (MYR-locked v1) | P0 | No (demo is MYR-only) | — | A12 |
| In-app help / CMS for user manuals | P1 | Yes | Kak Yati, Setiausaha | R293-R295 |
| PWA offline mode (service worker, IndexedDB, ~60s autosave, background sync) | P0 | Yes (one screen: cash book) | Kak Yati | B13, R184-R190 |
| LHDN e-Invoice workflow | P0 | Yes (UI-complete, mocked backend) | Kak Yati, Setiausaha | A16-R1, R36, R56, R143-R145 |
| Integration Framework (External System entity, adapter interface, audit log) | P0 | Yes (mock adapters) | Parsec, Puan Suraya | B14 |
| PDPA compliance (privacy notice, consent, data export, deletion, DPO workflow) | P0 | No (post-demo) | Parsec | B3 |
| Notifications (deadline, signal alerts) | P0 | Yes | Kak Yati, Setiausaha | R36, R203-R204 |
| Data warehouse (separate from operational DB; integration target) | P1 | No | Parsec | R218-R220 |
| Data encryption at rest + in transit | P0 | No (post-demo) | — | B3, R340 |
| Backup + recovery (daily, tested) | P0 | No (post-demo) | Parsec | R302-R303, R316-R317 |
| Helpdesk module (in-app ticket submission, severity levels) | P0 | No (post-demo) | All | R40-R48 |

### 5.2 Koperasi Pack features

| Feature | Priority | Demo-critical | Persona(s) | Spec ref |
|---|---|---|---|---|
| GP23-shaped chart of accounts (seeded from Easy Coop NKA) | P0 | Yes | Kak Yati | R148 |
| Statutory Reserve Fund calculation (Akta §57, 25% default, configurable up) | P0 | Yes | Setiausaha | A13, B4 |
| Cooperative Education Trust Fund contributions | P0 | Yes | Setiausaha | A13 |
| Cooperative Development Trust Fund contributions | P0 | Yes | Setiausaha | A13 |
| Akaun Pembahagian Keuntungan (Profit Distribution) | P0 | Yes | Kak Yati, Setiausaha | R150 |
| Member register (CRUD, export per SKM template) | P0 | Yes | Kak Yati, Setiausaha | A7, R136-R140 |
| Member share capital / bonus shares / redemption workflow | P0 | Partial (CRUD shown; full workflow post-demo) | Setiausaha | A13 |
| Surplus distribution workflow (statutory → education → development → dividend → bonus) | P0 | Demo shows calculation; workflow post-demo | Setiausaha | A13 |
| Grant-asset segregated depreciation (ASET GERAN per GP8) | P0 | Yes | Kak Yati | A9, B4 |
| Ar-Rahnu subsidiary ledger | P0 | Yes (shell + seeded data) | Kak Yati | B20 |
| Ar-Rahnu collateral register | P0 | Yes (shell + seeded data) | Kak Yati | B20 |
| Ar-Rahnu interest accrual engine | P0 | No (v1 post-demo) | Kak Yati | B20 |
| Ar-Rahnu Shariah rate configuration | P0 | Yes (configuration screen only) | Setiausaha | B20 |
| Ar-Rahnu pawn-ticket lifecycle | P0 | No (v1 post-demo) | Kak Yati | B20 |
| SKM audit fee as prescribed liability line | P0 | Yes | Kak Yati | A14 |
| GP23-conformant PDF reports (Penyata Kewangan) | P0 | Yes (3 note schedules + 4 primary statements) | All | R148-R154 |
| SKM hierarchical dashboard (HQ / state / zone) | P0 | Yes | Puan Suraya | B15, R37-R43 |
| Koperasi geographic grouping (state + zone fields) | P0 | Yes | Puan Suraya | B15 |
| Seeded SKM peer-benchmark data (derived from public SKM stats) | P0 | Yes | Kak Yati, Setiausaha | A14 |
| Koperasi-specific Signal rules (GP23 deadlines, SRF under-accrual, member default) | P0 | Wireframed for demo; live v1 | All | A17 |
| 80+ note schedule templates (n3-n83 from Easy Coop) | P0 | Demo ships subset of ~5; full set v1 | Kak Yati, Setiausaha | R148-R154 |

### 5.3 Signal Engine (v1 locked to all 6 categories per A17; demo depth per B19)

| Signal category | Demo | v1 production | Description |
|---|---|---|---|
| **Anomaly Detection** | Live | Full | Flags unusual transactions, spikes, off-pattern vendor payments, duplicated entries. LLM-backed natural-language explanations. |
| **Financial Health Scoring** | Live | Full | Composite score from liquidity, profitability, activity ratios, member engagement. Peer benchmarks from SKM public data. Score dial + trend + breakdown. |
| Cash Flow Forecasting | Wireframed | Full | 90-day projection with scenario toggle (optimistic/expected/pessimistic). |
| Compliance Nudges | Wireframed | Full | GP23 deadline reminders, SRF under-accrual detection, statutory return alerts. |
| Pattern Insights | Wireframed | Full | Year-over-year trend surfacing, seasonal patterns. |
| Member-Level Signals | Wireframed | Full | Member default risk scoring, shareholding change alerts. |

### 5.4 What is NOT in v1 (anti-scope)

Active anti-scope (from B9 + A16-R1):

- SST return generation and automation (SST-02, SST-02A) → v2 SME Pack
- MPERS-specific SME disclosure templates beyond Koperasi Pack → v2 SME Pack
- Automated bank feed integration (Maybank, CIMB, RHB, Public Bank via open banking) → v2
- FX rate feeds, multi-currency UX activation → v2 (scaffolding retained per A12)
- Foreign jurisdiction support → future
- Native mobile apps (iOS/Android) → future (PWA sufficient for v1)
- Payroll module (EPF/SOCSO/EIS/PCB) → v2+
- POS integration (petrol station, pharmacy, grocery) → v2+
- Full Ar-Rahnu operational product (pawn-ticket customer-facing workflow) → separate Ar-Rahnu pack future
- Co-opBank-specific features (GP11 coverage) → not in market
- Multi-entity consolidation → out of architectural scope
- **AI Advisor / natural-language chat over ledger data** → skipped entirely (Decision from Phase 2 Q4). Signal engine alone is sufficient differentiator; conversational AI risk-reward is unfavourable now.

---

## 6. User Flows (High-Level)

Ten primary flows for v1. Each captures the happy path and the most important edge cases. Detailed flows and error states are Phase 3 work.

### 6.1 Flow: Kak Yati records a cash receipt

**Happy path:**
1. Kak Yati opens AMIR on her laptop in the koperasi office
2. Navigates to "Buku Tunai" → "Terimaan"
3. Selects bank account from dropdown, enters amount, selects income account from dropdown, enters description and optional attachment
4. System auto-generates the contra (debit bank, credit income) and saves
5. Receipt number auto-issued; PDF receipt generated; option to print or email to payer

**Edge cases:**
- If internet drops mid-entry → PWA autosaves to IndexedDB every 60s, transaction marked "pending sync"; on reconnect, background sync pushes to server; Kak Yati sees sync indicator clear
- If debit and credit don't balance (data corruption) → system blocks save, shows error dialog, asks to reload
- If receipt number already issued (unlikely with server-side generation) → collision detection, re-request number

### 6.2 Flow: Kak Yati reconciles the bank statement

**Happy path:**
1. Kak Yati uploads bank statement (.txt or CSV)
2. System matches statement entries against ledger entries based on amount, date, reference
3. Unmatched entries flagged for review; Kak Yati resolves manually (match, add missing ledger entry, mark as bank fee, etc.)
4. Upon completion, system generates Penyata Penyesuaian Bank (bank reconciliation statement) per GP23

**Edge cases:**
- Statement has entries not in ledger → Kak Yati adds them as new transactions via same screen
- Ledger has entries not in statement → flagged as outstanding (deposits in transit or uncleared cheques)
- File format rejected → clear error, link to supported format doc

### 6.3 Flow: Setiausaha closes the month

**Happy path:**
1. Setiausaha navigates to "Penyelenggaraan" → "Penutupan Bulanan"
2. System runs pre-close checks: all transactions reconciled, no balancing errors, deadline not missed
3. Setiausaha reviews trial balance preview, confirms
4. System locks the period (no more edits), carries forward ending balances
5. Monthly dashboard updates with finalised signals

**Edge cases:**
- Pre-close checks fail → blocking error with specific list of unresolved items; cannot close until resolved
- Late close → compliance nudge signal fires; no blocking, but flagged on SKM dashboard

### 6.4 Flow: Setiausaha generates year-end financial statements

**Happy path:**
1. Setiausaha navigates to "Laporan" → "Penyata Kewangan"
2. Selects financial year (auto-populated)
3. System runs year-end pre-checks (all months closed, adjustments posted, Statutory Reserve Fund accrued)
4. If Ar-Rahnu active, Ar-Rahnu notes computed; if grants received, GP8 treatment applied
5. System generates the full Penyata Kewangan package: Kunci Kira-Kira, Akaun Pembahagian Keuntungan, Akaun Untung Rugi, Penyata Aliran Tunai, Nota-nota kepada Akaun — all GP23-conformant
6. Setiausaha reviews PDF, exports, sends to auditor

**Edge cases:**
- Missing SRF accrual → pre-check fails with actionable fix suggestion ("Accrue RM X to Statutory Reserve Fund per §57")
- Unapproved journal entries pending → blocks until Setiausaha approves or reverses them

### 6.5 Flow: Kak Yati enters a transaction offline

**Happy path:**
1. Kak Yati opens AMIR on her laptop; no internet
2. App loads from PWA cache, shows "Offline" indicator
3. Kak Yati navigates to Buku Tunai, enters a receipt exactly as normal
4. Transaction saved locally (IndexedDB); appears in the ledger with "pending sync" badge
5. When internet returns, background sync pushes transaction to server; badge clears

**Edge cases:**
- Receipt number generation offline → generate temporary client-side number; server reconciles on sync (server is authoritative for final numbering)
- Conflict on sync (unlikely for single-user tenant) → server rejects, client shows conflict dialog
- Extended offline (>7 days of cached data) → warning banner; recommend coming online before exceeding cache limits

### 6.6 Flow: Puan Suraya reviews a koperasi's compliance

**Happy path:**
1. Puan Suraya logs into SKM dashboard
2. Lands on "Koperasi Needing Attention" view — sorted by severity (missed reports, compliance flags, anomaly signals)
3. Clicks a specific koperasi → drill-down to their ledger, Penyata Kewangan, Signal alerts, member register
4. Flags items for follow-up (creates internal SKM note)
5. Exports evidence (PDF of financial statements + signal alert log) for her audit file

**Edge cases:**
- Koperasi's tenant has opted out of signal sharing → Puan Suraya sees structured compliance data but not detailed signals (per tenant-level privacy settings, v2)
- Drill-down request hits an offline-syncing tenant → shows last-known-good data with timestamp; clear indicator of stale data

### 6.7 Flow: Kak Yati submits an e-invoice

**Happy path (UI-complete for demo; full MyInvois integration post-demo):**
1. Kak Yati enters a sale / invoice as normal in AP/AR module
2. Clicks "Submit to MyInvois" — system validates LHDN mandatory fields are present
3. Invoice is packaged in LHDN JSON format, submitted to MyInvois (mocked backend for demo; real LHDN sandbox for production)
4. MyInvois validates, returns UIN and QR code
5. System attaches UIN to invoice record; user sees confirmation with UIN visible

**Edge cases:**
- LHDN validation fails (missing field, bad format) → error displayed with specific field fix suggestion
- LHDN service down → submission queued; retry on schedule; admin notification
- Invoice cancellation (within 72 hours) → cancel workflow; generates cancellation record

### 6.8 Flow: Setiausaha configures the tenant

**Happy path (tenant admin first-time setup):**
1. Setiausaha receives invitation email (from Parsec or SKM if tender-delivered)
2. Logs in, lands on tenant onboarding wizard
3. Enters koperasi details (registration number, state, zone, fiscal year, accounting standard — MPERS or MFRS)
4. Selects active packs (Koperasi always; if Ar-Rahnu applicable, enables that sub-module)
5. Imports opening balances via Excel upload (or from SKM's SAK system per B14, for Easy Coop 2.0 variant)
6. System seeds GP23 chart of accounts, creates initial period, sends confirmation to Setiausaha

**Edge cases:**
- Invalid koperasi registration number → validation fails (cross-check with Infokop when integration live, per B14); manual entry allowed with warning for AMIR SaaS
- Opening balance import has errors → line-level validation, downloadable error report, retry with corrections

### 6.9 Flow: Puan Suraya views the SKM hierarchical dashboard

**Happy path:**
1. Puan Suraya logs in
2. Default view: HQ-level aggregation (all koperasi, all states, all zones)
3. Filters by state (Selangor) → state-level aggregation
4. Filters by zone (Barat) → zone-level aggregation
5. Each level shows: koperasi count, total assets, total turnover, compliance status breakdown, signal alert counts
6. Interactive drill-down through the hierarchy

**Edge cases:**
- Zone boundaries ambiguous (per B15 note) → configurable state-to-zone mapping in platform admin; defaults to SKM's official definition once confirmed in Phase 6

### 6.10 Flow: Parsec operator onboards a new koperasi tenant

**Happy path (for AMIR SaaS; Easy Coop 2.0 has SKM-mediated equivalent):**
1. Parsec operator receives paid signup (or referral from auditor partner)
2. Operator opens Parsec admin dashboard → "Add Tenant"
3. Enters koperasi details, creates Setiausaha user, sets active packs
4. System provisions isolated tenant space, sends invitation to Setiausaha
5. Setiausaha runs the tenant configuration flow (6.8 above)
6. Operator monitors onboarding completion in their dashboard

**Edge cases:**
- Duplicate tenant (same registration number) → collision check, ask to confirm or merge
- Setiausaha invitation bounces → resend workflow; fallback to SMS or direct phone contact

---

## 7. Non-Functional Requirements

All locked in Decision B18.

### 7.1 Performance
- Page response **< 2 seconds at 100 concurrent users on peak** (exceeds tender spec R242's 3-second target)
- Report generation **3-7 seconds per 10MB** (exceeds spec R244's 5-10s target)
- Infrastructure headroom: sized for **5,000 concurrent users** (spec requires 3,000)
- Listed as Nilai Tambah entry in tender response

### 7.2 Availability
- **99.0% monthly** (max 7.2 hours downtime)
- Announced scheduled maintenance windows excluded from calculation
- Public status page (Phase 12 pre-flight item)
- Note: Tender SLA A5-i requires 4-hour Sev 1 resolution for Easy Coop 2.0 — tighter than AMIR's 99.0% commitment; handled in tender-proposal chat

### 7.3 Browser support
- Any browser with modern JS (ES2020+), Service Worker API, IndexedDB API
- Primary test matrix: last 2 versions of Chrome, Edge, Safari, Firefox
- Graceful degradation for older browsers: site loads, transaction entry works, no PWA offline
- Not supported: IE11 and earlier

### 7.4 Security & Data
- PDPA 2024 compliant: DPO appointed, 72hr breach notification workflow, Malaysian data residency (Azure Malaysia West or AWS KL)
- Encryption at rest (AES-256) + in transit (TLS 1.3)
- Audit log retained 6 years per Akta Koperasi Peraturan 31
- MFA available for SKM platform admin personas
- Session timeout: 30 min idle; configurable per tenant

### 7.5 Localisation
- Bahasa Malaysia (primary) + English
- Malaysian date format (DD/MM/YYYY), MYR currency, MYT timezone
- Accounting standard: MPERS default (Koperasi), MFRS optional
- Number formatting: Malaysian convention (comma thousands, period decimal)

### 7.6 Accessibility
- WCAG 2.1 Level AA for critical paths (login, transaction entry, report viewing)
- Keyboard navigation for all primary actions
- Screen reader labels on forms
- Colour contrast compliant

### 7.7 Offline (PWA per B13)
- Installable via browser prompt
- Offline scope: transaction entry, draft documents, cached data viewing, search over cached data
- ~60 second autosave
- Background sync on reconnect, server-authoritative conflict resolution
- Not offline: full report generation, concurrent offline edits, e-Invoice submission

---

## 8. Integration Points

Per Decision B14, integrations split into AMIR-Core framework (generic) vs. Easy Coop 2.0-fork adapters (SKM-specific).

### 8.1 AMIR Core — generic integrations

| Integration | Direction | v1 scope | Notes |
|---|---|---|---|
| **LHDN MyInvois** | Outbound (invoice submission) + Inbound (validation status) | UI-complete demo with mocked backend; real LHDN sandbox integration post-demo | Table stakes for SME Pack v2; pulled into v1 core per A16-R1 |
| **Excel/CSV import** | Inbound | Yes v1 | Opening balance import, member register import |
| **Excel/CSV/PDF export** | Outbound | Yes v1 | All reports exportable |
| **Email notifications** | Outbound | Yes v1 | Deadline reminders, signal alerts, report-ready notifications |
| **WhatsApp notifications (via WhatsApp Business API)** | Outbound | P1 (v1 if time) | Kak Yati and Setiausaha culturally prefer WhatsApp |

### 8.2 Easy Coop 2.0 fork — SKM-specific adapters (not in AMIR)

Per B14, the following are built in the tender fork only, on top of the Core Integration Framework:

| Adapter | Direction | Source/Sink |
|---|---|---|
| **Infokop** | Inbound | Master data sync: koperasi name, registration number, activity code, board members |
| **SPKB (Sistem Pengurusan Koperasi Bersepadu)** | Bidirectional | Koperasi management status, licences, approvals |
| **SPMKK (Sistem Pengurusan Maklumat Kewangan Koperasi)** | Outbound | Annual financial statements push |
| **SAK (Sistem Pengauditan Koperasi)** | Bidirectional | Audited opening balance import (GP23-formatted); management accounts push |

For 21 May demo: all four shown as mock adapters (label + seeded data) so evaluators see the Integration Framework concept.

### 8.3 Third-party services (operational)

| Service | Purpose | Status |
|---|---|---|
| **Malaysian cloud provider** (Azure Malaysia West, AWS KL, or local) | Application + database hosting | Phase 5 decision |
| **LLM API** (Claude via Anthropic) | Signal engine natural-language explanations | Phase 5 decision; cost monitoring critical |
| **Email provider** (Postmark, SendGrid, or regional equivalent) | Transactional email | Phase 5 decision |
| **Error monitoring** (Sentry or equivalent) | Production error tracking | Phase 5 decision |
| **Analytics** (PostHog, Matomo, or custom) | Usage analytics (PDPA-compliant) | Phase 10 decision |
| **Payment gateway** (Billplz, iPay88, or regional) | Subscription billing for open-market | Phase 5 decision |
| **PDSA JDN** | Easy Coop 2.0 production deployment (tender only) | Tender-chat scope |

---

## 9. Competitive Position

Named competitive set (Decision B5), positioned against AMIR's differentiators:

### 9.1 Direct Koperasi competitors

| Competitor | Positioning | AMIR advantage |
|---|---|---|
| **Easy Coop Excel** (the tool being replaced) | Free, GP23-aligned, familiar | Cloud, AI, offline, regulator integration, modern UX |
| **ANGKASA SPBA** | Free to ANGKASA members, desktop | AI Signal, cloud-first, open to all koperasi, non-desktop access |
| **SYS.COOP** | Cloud web-based koperasi management | AI Signal engine, TEHA-class polish, integration framework, open market via pack architecture |

### 9.2 Open-market SME competitors (relevant for v2)

| Competitor | Scale | AMIR wedge |
|---|---|---|
| **SQL Account** | 600K+ users | AI Signal; modern cloud UX; vertical pack extensibility |
| **AutoCount** | 240K+ companies | AI Signal; regulator-native architecture; cleaner UX for non-accountants |
| **Bukku, QNE** | Growing | AI Signal; vertical packs as first-class products |
| **Xero, QuickBooks** | Global | Bahasa Malaysia first; regulatory-native; regulator integration |
| **Info-Tech, Biztrak, SimpanKira, Financio** | Malaysian SaaS | AI Signal; vertical pack architecture |

### 9.3 Indirect / structural competitors

- **Excel + WhatsApp** — the current tool for ~13,500 Micro koperasi. Hardest to displace; beaten only by providing enough differential value that Kak Yati actively prefers AMIR.
- **External accountants** — some koperasi outsource entirely. AMIR partners with cooperative auditors as referral channel (Q8 primary research pending).
- **Doing nothing** — audit-failure tolerance. DaKoM 2030 compliance push narrows this path.

---

## 10. Regulatory Reality

Full reference in `VIABILITY_REPORT.md` Section 1.2 and Decision B4. Summary:

### 10.1 Binding on v1 (compliance must work)

- **Akta Koperasi 1993** §§57 (SRF 25%), §58 (records + 2-month statements + 30-day transaction entry), §59(3) (board declarations), §65A (tax)
- **Akta A1297 (2007)** and **Akta A1634 (2021)** — current amendments
- **Peraturan-Peraturan Koperasi 2010** — Peraturan 31 (6-year retention, SKM-prescribed format)
- **GP23 (Pindaan 2020/2023)** — the authoritative format specification. 62 pages, 6 sections.
- **GP8** — grants/subsidies accounting (ASET GERAN)
- **PDPA 2010 + Amendment 2024** — DPO, 72hr breach notification, data processor direct liability, Malaysian residency, max RM 1M fine + 3yr imprisonment
- **Cybersecurity Act 2024** — monitor for CII classification; adopt RMiT-adjacent controls as best practice
- **Income Tax Act §65A** + **Borang C1 / e-C1** — cooperative tax; **DRAFT computation in v1 via Module T (Tax & Zakat) per Decisions B24, C81–C84**. Actual filing remains an out-of-band action via LHDN MyTax. Zakat draft also supported (two methods configurable).
- **MPERS** default / MFRS optional for Koperasi pack

### 10.2 Binding on v1 (new from A16-R1)

- **LHDN e-Invoice (Guideline v4.6)** — MyInvois integration; RM1M turnover threshold; Phase 4 (RM1M-5M) live; Phase 5 (<RM1M) live from 1 Jul 2026
- **Individual e-invoice above RM10,000** — no consolidation allowed

### 10.3 Deferred (v2+)

- **SST Act 2018** — SST-02 returns; v2 SME Pack
- **Employment Act 1955 + EPF/SOCSO/EIS/PCB** — payroll module; post-v2

### 10.4 Out of scope

- **GP11** — Co-opBank (different market; full banking systems serve this)
- **BNM regulations** — AMIR not a deposit-taking or lending institution

---

## 11. Market Opportunity

Full detail in `VIABILITY_REPORT.md`. Summary metrics:

- **Total Koperasi (Jun 2025):** 16,342 with 7.41M members, RM 268B assets, RM 40B H1 turnover
- **Addressable for AMIR Koperasi Pack:** ~15,000 (Small + Medium + Micro clusters)
- **TAM for SME Pack v2:** hundreds of thousands (SQL Account alone has 600K users)
- **DaKoM 2030 target:** RM 73B sector revenue by 2030 — implies ~80% growth from 2024

Pricing assumptions (not locked; Phase 2 sketch):

- **Koperasi via tender:** per-tenant subscription with platform fee structure; tender-defined
- **Koperasi open-market:** RM 50–200/month per tenant, tiered by size; micro koperasi may get free or discounted tier for acquisition
- **SME open-market (v2):** RM 50–300/month, tiered

---

## 12. Success Metrics (Decision B17)

### 12.1 Tender Demo — 21 May 2026

**Primary:** Positive written evaluator feedback on prototype quality (independent of final tender ranking)
**Secondary:** Screenshots and ~2-minute walkthrough video reusable as open-market marketing evidence

### 12.2 v1 Production (post-tender, speculative Q4 2026 – Q1 2027)

**Primary:** Active tenants onboarded (logged in AND entered transactions)
**Secondary:** first_login rate, first_transaction rate, monthly_active_tenant

### 12.3 Open-Market Growth (2027)

**Primary:** Paying tenant count (discrete commercial koperasi paying subscription)
**Why not MRR:** Paying tenant count is harder to manipulate; forces genuine acquisition

---

## 13. Open Questions & Research Dependencies

Eight open questions from Decision B7, still active:

| # | Question | Gate |
|---|---|---|
| Q1 | The tender RFP narrative itself (Syarat-Syarat) | Blocking for Phase 4 entry (per Gate B2); specification compliance schedule received |
| Q2 | State-level GP23 / Easy Coop variations | Blocking for Phase 6 |
| Q3 | Tender evaluation weighting | Blocking for tender submission (handled in separate chat) |
| Q4 | RFP-stated DPO / IRP / pen-test / ISO requirements | Blocking for Phase 12 pre-flight |
| Q5 | ANGKASA SPBA current product state | Informational — Phase 2 positioning |
| Q6 | SYS.COOP pricing and customer base | Informational — Phase 2 positioning |
| Q7 | Koperasi count crossing LHDN e-Invoice threshold | Informational — v2 SME pack priority |
| Q8 | Top cooperative auditor firms for partner channel | Informational — 2027 go-to-market |

---

## 14. Next Actions

**Phase 2 outputs produced:**
- This `PROJECT_CONTEXT.md`
- `PROJECT_CONTEXT_INTERACTIVE.html` (companion)
- `PROJECT_BRIEF.md` (one-page executive summary)

**Move to Phase 3 (Business Flows):** Translate the 10 user flows in Section 6 into detailed, step-by-step business-flow diagrams (Mermaid) per framework Section 3. Each flow expanded to: trigger → inputs → system steps → outputs → error paths.

**Phase 3 produces:** `BUSINESS_FLOWS.md` + `BUSINESS_FLOWS_INTERACTIVE.html` with Mermaid diagrams for each flow.

---

## CHANGE LOG

| Date | Change |
|------|--------|
| 2026-04-21 | v1.0 initial production — Phase 2 Product Definition complete |
| 2026-04-23 | v1.1 — §3.2 rewritten to reflect B10-R1 (copy-and-detach fork, not shared codebase). §4 restructured to distinguish three canonical roles (authoritative) from four illustrative personas. |
