Suppose a bond has annual coupon of \$1 and face value of \$100 and matures in two years. If recovery rate is $50\%$ and the bond defaults before the first coupon payment. How should we receive the recovery? Is it \$50 at year 2 or \$0.5 at year 1 and \$100.5 at year 2?
Generally, the developed markets convention is that all the coupon that has been accrued and not paid yet just disappears, but the remaining notional is accelerated - becomes due immediately. To illustrate, suppose for concreteness that the issuer has two bonds. One pays 6% coupon, and matures in 2 years, bullet. The other pays 7% coupon, matured in 10 years, and has amortized, so the current factor is 75%. If the issuer defaults, then the coupons don't matter, the maturities don't matter. The current interest rate levels don't matter. The recovery is on face value of the bullet bond and 75% of face value of the amortized bond. Now, if instead of a bond you issue a bespoke credit-linked note, then you can specify anything you like on the term sheet. In particular, you can say that in case of a credit event, the coupon accrues until the day of default (like running spread of a credit default swap). You can also link the recovery to interest rates in some way. Although this is very seldom done, a good analytics library should have the flexibility to support this.